naag Posted December 7, 2012 Share Posted December 7, 2012 (edited) Title<img src="images/smallindex.jpg" /></td><td><html:select property="title"><html:option value="">--SELECT--</html:option><html:option value="Mr."></html:option><html:option value="Mrs."></html:option></html:select></td><html:submit value="submit" styleClass="button" property="method" onclick="onSave()"/>function onSave(){if(document.forms[0].title.value==""){alert("Title should not be left blank");document.forms[0].getElementById('personalInformation').title.focus();//document.forms[0].title.focus();return false;}} i donno what wrong in this script, it not focusing on title if it is empty....can u please someone help me..thanks ... Edited December 7, 2012 by naag 1 Link to comment Share on other sites More sharing options...
Ingolme Posted December 7, 2012 Share Posted December 7, 2012 Just document.getElementById(). You don't need the forms[0] part, and the ID should be the ID of the specific input you want focused. document.getElementById("title").focus(); 2 Link to comment Share on other sites More sharing options...
naag Posted December 10, 2012 Author Share Posted December 10, 2012 Thankq....thanks a lot...now it s proper... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now