When I set a field to mandatory, and subsequently hit 'Submit', the fields(s) are all highlighted at once, with 'Please complete the mandatory field before submitting'.
You need to use the undocumented "addValidator" method. Its usage is described in the ISF Training guide. Also search for "addValidator" on this site and there will probably be a few other messages about it.
Oh, and please submit an enhancement request that select contol mandatory validation should be built into the product. It is crazy that every customer on every form that includes a selection list needs to add custom validation code. There should be an option in ServiceDeisgner to treat the first item in the list as "not filled out" and RC should take care of the rest.
Or at least allow the user to use a #DEFINE where they allocate certain values to be synonymous with the concept of a blank field. I agree, it should be in the code. Have you used this addValidator method? will this highlight all the 'user-defined-mandatory' fields upon submission? I haven't tried this, but will. thanks for the advice!
Thank you for the slides. I will try them out. However, wouldn't it be a *drop* safer if the statement for setting mandatory did not termporarily blank out field values, but just *checked* for them.
For example, I used this:
var myString = currentField.id;
var myrealString = myString.toString();
// field names that I have in my dictionaries do NOT have ANY underscore in them
// the value of our fields is not '-- Please Select--' but '- - -'. (that can be substituted)
if ((myrealString.search("_") == -1) && ((currentField.getInputType()== "select") && currentField.isMandatory() && currentField.getValue() == "- - -"))
doing global replaces seems a little scary, otherwise.
Also, can you please explain each of the parameters for addValidator?
parameter 1 = 'null' what does this signify
parameter 2 = true, what does that signify
parameter 3: string 'Please fill out....' I assume that this is the instructional (help ) text that is replaced with this string; is there a way of preserving the help text and APPENDING this string to it? if the user didn't fill it out, there is a good chance they dont know WHAT to fill it out with, and replacing vital help info with standardized mandatory text seems to defeat the purpose.