You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by nagabrahmam <fo...@opensymphony.com> on 2006/03/22 12:34:23 UTC
userdefined client-side validations in struts
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=23162&messageID=44911#44911
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org