This does not work:
The site I want to use the script on is being database generated and has something like 25,000 item pages, each with several SELECT list options. The Option variable uploaded to the database looks like:
so it would be a serious task to download the database, loop through and replace white-space characters with dashes or underscores on the first element in each option sequence. Is there some way to make names with white spaces work? I could switch to a script that simply checks all selection lists to make sure that option 0 is not selected. But I love all the other features of name, format and combined verification in the above script. Unfortunately, the script relies on the name and validation action of each form element being passed to its function onSubmit. I thought I would ask if anyone can see a way to adapt the script to handling white-spaces before giving up on the idea.
"Optional Out Going Mail Slot" "Please Choose" "None, Thanks" "Please Add Mailslot in Top Left (Item # na) (+$15.00)" "Please Add Mailslot in Top Right (Item # na) (+$15.00)" "Please Add Mailslot in Bottom Left (Item # na) (+$15.00)" "Please Add Mailslot in Bottom Right (Item # na) (+$15.00)"
Last edited by ETpro; 04-10-2010 at 05:18 PM.
The space is of cause invalid, hence your problem.
frmvalidator.addValidation("First\u0020Name","req","Please enter your First Name");
Thanks, Fang. Unfortunately, his much I knew.
Originally Posted by Fang
Question is, are there ways to fix this problem short of reworking the entire database to eliminate white-spaces? If I must rework the database, can I use the ASCII or Unicode non-breaking-space or must I substitute an underscore or dash character for each white-space?
Maybe I have been over thinking this. I could use the query language in the site's back end to strip out the white-spaces in the SELECT list name. So instead of "Optional Out Going Mail Slot", which I display as the LABEL for the SELECT list, I write the name as "OptionalOutGoingMailSlot" and pass that to my script. The only downside is some of the error messages my script throws will get a bit strange looking, like
OptionalOutGoingMailSlot: Please select one option.
So, now the question becomes can I use JS to loop through the output string and insert a space before each Capital Letter in the name?
Last edited by ETpro; 04-11-2010 at 01:59 PM.
The Unicode in the example script worked correctly
Interesting. I tested it server side, and it failed, but it works on the desktop. Not robust enough. I think I need to use underscores to be certain it works. That still yields a perfectly readable error output.
Thanks to all for helping me think this through.
The Unicode is only in the script , not in the html
Outstanding. Based on your confidence, I went back and tested it again on the Yahoo Store server. Indeed it does woik with the Unicode non-breaking-space. See http://www.babygiftsandproducts.com/form-test.htm for a test of the script.
Originally Posted by Fang
Thanks, Fang. I can write an RTML routine to find the white spaces in the name element of each SELECT list and replace them with the Unicode non-breaking-space character. RTML supports Perl REGEX search and replace. So I can use it to loop through the database, update each Option SELECT list, and export a CSV file which I can then use to actually modify the database.
Last edited by ETpro; 04-11-2010 at 04:30 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread