You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Mainguy, Mike" <MM...@kmart.com> on 2003/07/31 15:03:00 UTC

RE: ..javascript

I my html:javascript looks like this
  <html:javascript formName="logonSubmit" dynamicJavascript="true"
staticJavascript="true"/>
don't know if those other two attributes matter or not...
In addition, I put the html:javascript tag at the bottom of my page.

For What It's Worth


-----Original Message-----
From: Prashant Samant [mailto:Prashant.Samant@mphasis.com] 
Sent: Thursday, July 31, 2003 7:17 AM
To: Struts Users Mailing List (E-mail)
Subject: <html:radio>..javascript

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/mVtrVal
idation.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


This message and its contents (to include attachments) are the property of Kmart Corporation (Kmart) and may contain confidential and proprietary information. You are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on information contained herein is strictly prohibited. Unauthorized use of information contained herein may subject you to civil and criminal prosecution and penalties. If you are not the intended recipient, you should delete this message immediately.



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


RE: ..javascript

Posted by Steve Raeburn <sr...@apache.org>.
html:javascript defaults to true for both dynamic and static parameters so
that shouldn't make a difference.
Also, location on the page doesn't matter (I stick it in the head section).

Steve

> -----Original Message-----
> From: Mainguy, Mike [mailto:MMainguy@kmart.com]
> Sent: July 31, 2003 6:03 AM
> To: 'Struts Users Mailing List'
> Subject: RE: <html:radio>..javascript
>
>
> I my html:javascript looks like this
>   <html:javascript formName="logonSubmit" dynamicJavascript="true"
> staticJavascript="true"/>
> don't know if those other two attributes matter or not...
> In addition, I put the html:javascript tag at the bottom of my page.
>
> For What It's Worth
>
>
> -----Original Message-----
> From: Prashant Samant [mailto:Prashant.Samant@mphasis.com]
> Sent: Thursday, July 31, 2003 7:17 AM
> To: Struts Users Mailing List (E-mail)
> Subject: <html:radio>..javascript
>
> 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-I
> NF/mVtrVal
> idation.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
>
>
> This message and its contents (to include attachments) are the
> property of Kmart Corporation (Kmart) and may contain
> confidential and proprietary information. You are hereby notified
> that any disclosure, copying, or distribution of this message, or
> the taking of any action based on information contained herein is
> strictly prohibited. Unauthorized use of information contained
> herein may subject you to civil and criminal prosecution and
> penalties. If you are not the intended recipient, you should
> delete this message immediately.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
>



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