In the 8.0.3 environment after a user types an invalid value in a listbox field the invalid value is cleared out and the message bar displays the "Value not in list:" error.
In the 9.0 environment after a user types an invalid value in a listbox field the invalid value remains in the field and the message bar displays the "Value not in list:" error.
On my custom form, my Design Studio script checks to make sure that required listbox fields are not blank. In 8.0.3 this also ensured that the value is a valid value but in 9.0 the user can now submit with an invalid value. I am looking for a way to force the listbox field to be blank when a user enters an invalid value. If I can't do this and I need to add a check before the submit to verify that the value entered is a valid value, what is the most efficient way of going about that?
Deborah:
First, I would introduce the Form_OnBeforeTransaction method to the form. Then isolate your listbox value, assigning it to a declared variable to make it easy to read, this is an example that should work, but you will need to change the name of your variable. var enteredValue = lawForm.getDataValue("RQH-PO-USER-FLD-1",0) alert(enteredValue); return false; Returning "false" stops the form being submittted, you can verify what was entered. If this works, you can define a method that examines the entered character and takes appropriate action, again, just an example: if (!validSelect(lawForm.getDataValue("RQH-PO-USER-FLD-1",0)) { return false; } else { return true; } function validSelect(listValue) { // a null value has been entered if(!listValue { alert("Please enter a valid value"); return false; } switch(listValue) { case "A": return true; case "B"; alert ("B is not permitted"); return false default: alert("You have entered an invalid value and cannot submit this form"); // clear the entered value lawForm.setFormValue("form_control_name_here","",0); // reset the browsers status bar self.status = ""; return false } }
I use switch and case whenever I can, cleaner and faster than nested if statments. I also advise you to confirm that If you are running IE7, make certain you have status messages writing to the browser.
Hope this helps.
Regards,
Robert