Calling Javascript from a sever control
-
I have written the following function to validate one of my forms :- function ValidateForm(Form) { var output = ""; output += CheckName(document.Form.txt_substance_name.value); output += CheckForm(document.Form.ddl_form.selectedIndex); output += CheckHazardGroup(document.Form.ddl_hazard_group.selectedIndex); for(i=0, n = documentForm.rbl_hazard.length; i
-
I have written the following function to validate one of my forms :- function ValidateForm(Form) { var output = ""; output += CheckName(document.Form.txt_substance_name.value); output += CheckForm(document.Form.ddl_form.selectedIndex); output += CheckHazardGroup(document.Form.ddl_hazard_group.selectedIndex); for(i=0, n = documentForm.rbl_hazard.length; i
Read rule number 4 in this[^]. You can't use a server control to call the javascript to validate the form. When the event runs to handle the server event, the form has already been posted. You have to call the function from client script. Here is an example on how you verify a form using client script: Javascript: Validate form[^] --- b { font-weight: normal; }