tejasri
question
1 Answer(s)      2 years and 7 months ago
Posted in : JSP-Interview Questions

Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some of the links.U have asked me the specify some details. There is a entity name label and registeration label in this two labels.If one we have selected then the other one should become optional.This is the problem sir.please help me regarding this promblem.

please help me as soon as possible sir.. Thanks for sending me the answeres for previous queries..

Thanks in advance teja

View Answers

November 15, 2010 at 12:25 PM


Hi Friend,

Try the following code:

<html>
<head>
<script>
function validate(){
    var n=document.form.name.value;
    var r=document.form.reg.value;
    if((n=="")&&(r=="")){
alert("*You have to attempt aleast one field!It is mandatory");
return false;

}
if((n=="")&&(r!="")){
alert("*Name field is optional!");
return true;
}
 if((r=="")&&(n!="")){
 alert("*Registration field is optional!");
return true;
}
return true;

}
</script>
</head>
<form name="form" method="post" onSubmit="return validate()" >
<table>
<tr><td>Name:</td><td><input type="text" size="20" name="name"></td></tr>
<tr><td>Registration:</td><td><input type="text" size="20" name="reg"></td></tr>
<tr><td><input type="submit"  value="Check"></td></tr>
</table>
</form>
</html>

Thanks









Related Pages:
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
question
question   sir plz tell me what should i give in title box. just i want java program for the question typed in this area
Question
Question   When there is an exception in my program how java runtime system handles
question
question  dear sir/madam my question is how to compare two text format in java..we are java beginners..so we need the complete source code for above mentioned question...we have to compare each and every word
question
question  Dear sir i had some typing mistake at previous question so its my humble request to let me know the steps to start the tomcat6 under the tomcat directory
question
question  Gud morning sir, I have asked u some question regarding jsp in saturaday for that i didnot find any answere in which u send me the some of the links.U have asked me the specify some details. There is a entity name
Question?
Question?  My question is how to: Add a menu bar to the program with a File menu. In the File menu, add a submenu (JMenuItem) called About. When the user clicks on the About menu item, display a JOptionPane message dialog