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:
"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)"
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.
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?
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, 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.