struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Prashant Samant" <Prashant.Sam...@mphasis.com>
Subject <html:radio>..javascript
Date Thu, 31 Jul 2003 11:16:54 GMT
Hello Group,
I want to put javascript validations on my page.
In simple words i have 4 radio buttons and submit button.
if i don't click any of the radio buttons and click submit, then i should get a javascript
error.
I tried a lot.I am getting the error using <html:errors> tag on the page.
But i am not getting the javascript POPUP.

My Html page is as follows
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<html:html locale="true">
	<body>
	<html:javascript formName="logonForm"/>
	<html:form action="/logonSubmit" focus="username" onsubmit="return validateLogonForm(this);"
>
		UserName : <html:text property="username" />
		Password : <html:password property="password" />
		Radio 1 :<html:radio property="selectRad" value="rad1"/>
		Radio 2 :<html:radio property="selectRad" value="rad2"/>
		Radio 3 :<html:radio property="selectRad" value="rad3"/>
		Radio 4 :<html:radio property="selectRad" value="rad4"/>		
		<html:submit property="submit" value="submit" />
	</html:form>
	
	</body>
</html:html>



My struts-config file contains

 <form-beans>

	<form-bean  name="logonForm"  type="org.apache.struts.validator.DynaValidatorForm">
              <form-property name="username" type="java.lang.String"/>
              <form-property name="password" type="java.lang.String"/>
              <form-property name="selectRad" type="java.lang.Boolean"/>
	</form-bean>
 </form-beans>
   
   <action-mappings>

  <action    path="/logonSubmit"
                       type="ValidateAction"
                       name="logonForm"
                       scope="request" 
                       validate="true" 
                       input="/validateeg.jsp">
    	  </action>
  </action-mappings>
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
    <set-property property="pathnames"
      value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml,/WEB-INF/mVtrValidation.xml,/WEB-INF/mVtrValidator-rules.xml"/>
  </plug-in>
  
  
  
  
  My validation.xml is as follows
  
  <form-validation>
  
  
      <!-- ========== Default Language Form Definitions ===================== -->
      <formset>
  
          <form name="logonForm">
  
              <field 
              	property="username"
                  depends="required,minlength,maxlength">
                     
  
                  <arg0 name="required"
                     key="logonForm.userName.displayName"/>
  
                  <arg0 
                     key="logonForm.userName.displayName"/>
                  <arg1 
                     name="minlength"
                     key="${var:minlength}" resource="false"/>
                  <var>
                  	<var-name>minlength</var-name>
                  	<var-value>3</var-value>
                  </var>
  
                  <arg0 
                     key="logonForm.userName.displayName"/>
                  <arg1 
                     name="maxlength"
                     key="${var:maxlength}" resource="false"/>
                  <var>
                  	<var-name>maxlength</var-name>
                  	<var-value>6</var-value>
                  </var>
  
             </field>
             
             
               <field property="selectRad" depends="required">
  	          <arg0 name="required" key="logonForm.userName.selectRadio"/>
                
  		</field>                        
          </form>
  
    </formset>
can anybody throw some light.

Best Regards,
Prashant S.

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


Mime
View raw message