on 2004 Dec 14 3:26 PM
Hi,
I have a dropdownlistbox on my screen and a button. Some processing is performed on the click of this button. But I also want to make sure that the user has selected some value from the dropdownlistbox otherwise an error message is displayed to the user. How do I achieve this?
For Inputfields I can say REQUIRED= "TRUE". But what do I do for the dropdownlistbox?
Regards
Tejaswini
The dropdownlist boxes has a value by default... Try putting the "SELECTION" attribute, and then the user will be forced to select another option if the default option doesnt fit with his-her needs.
Then if you dont want to do this, you always have the alternative of validating the fields on the server or adding some JavaScript to validate the field on the client.
If want to code some script you should code something like this:
function isBlank(val){
if(val==null){return true;}
for(var i=0;i<val.length;i++) {
if ((val.charAt(i)!=' ')&&(val.charAt(i)!="\t")&&(val.charAt(i)!="\n")&&(val.charAt(i)!="\r")){return false;}
}
return true;
}
Then just put the "dropdownlist.value" into that function.
Regards,
Ariel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ariel,
Thanks for the answer.It helped.
Came back to question so late as I was working on something else
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
66 | |
10 | |
10 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.