Options for Drop Down Boxes
Hi,
We have a client who is not happy that a form we have developed for them does not show the drop down fields as blank when when the form is first opened and instead shows the first item in the option list. The client would like the fields to be blank. We had the idea to place an item in the controlling list ***Please Select*** which the client would be happy with but only if we can prevent a user from submitting the form with ***Please Select***. We do not seem able to place validation that woudl revernt this from happening...
The field that is in use is a Lookup Field and probably needs to be so that teh end user can control the options in the form easily.
Thanks
We have a client who is not happy that a form we have developed for them does not show the drop down fields as blank when when the form is first opened and instead shows the first item in the option list. The client would like the fields to be blank. We had the idea to place an item in the controlling list ***Please Select*** which the client would be happy with but only if we can prevent a user from submitting the form with ***Please Select***. We do not seem able to place validation that woudl revernt this from happening...
The field that is in use is a Lookup Field and probably needs to be so that teh end user can control the options in the form easily.
Thanks
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi,
You can validate the selected value in fd.onsubmit handler via JavaScript:
You can validate the selected value in fd.onsubmit handler via JavaScript:
Code: Select all
fd.onsubmit(function() {
if (fd.field('LookupField').value() == 1) {
alert('Please, fill-in the Lookup Field');
return false;
}
return true;
});
- Dmitry Kozlov
- Site Admin
- Posts: 1524
- Joined: Thu Jun 07, 2012
Hi Katerina,
Please, make sure that there're no JS-errors in the browser console and that the handler is executed correctly. You can modify the code above to trace the lookup field value:
Please, make sure that there're no JS-errors in the browser console and that the handler is executed correctly. You can modify the code above to trace the lookup field value:
Code: Select all
fd.onsubmit(function() {
alert('OnSubmit handler is running');
alert('Selected ID: ' + fd.field('LookupField').value());
if (fd.field('LookupField').value() == 1) {
alert('Please, fill-in the Lookup Field');
return false;
}
return true;
});
-
- Information
-
Who is online
Users browsing this forum: No registered users and 4 guests