struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nagabrahmam <forum-struts-...@opensymphony.com>
Subject userdefined clientside validations in struts
Date Wed, 22 Mar 2006 05:36:39 GMT
How to use our own JAVASCRIPT tags on client side in struts-framework?
ie., how can i use userdefined validations on client side in struts?
i hava created a jsp page like this but it was not working.
//*.jsp
---------------------------------------------------------------------------------------------------------

<%@ taglib uri="/tags/struts-html" prefix="html" %>
<html:html>
	
	<head>
	<script language="JavaScript" src="script.js">
	</script>
	<title>Hello UserRegistration</title></head>
	<body>
		<bean:message key="errors.required" arg0="userName" >
		<html:form  action="hello.do"  onsubmit="return checkLogin(); ">
			<html:errors/>
			UserName<html:text property="userName" /><br>
			PassWord<html:password property="pwd1"/><br>
			Confirmp<html:password property="pwd2" /><br>
			Address <html:text property="address" /><br>
			<html:submit property="submit" /><br>
		</html:form>
	</body>
</html:html>
-------------------------------------------------------------------------------------------------------------------
//script.js
function checkLogin()
  {
   if(document.form1.userName.value == 0)
        {
         alert("please enter the UserName");
         document.form1.userName.focus();
        }
    else{
    	document.form1.submit();
    	}
    -------------------------------------------------------------------------
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=23163&messageID=44912#44912


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Mime
View raw message