struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Validate() in netscape
Date Mon, 07 Jul 2003 19:50:29 GMT
Is the oldPassword field definitely inside the form tags?

Put the following javascript in the preSubmit function before the 
submit() to help debug:

alert("oldPassword==" + form.elements['oldPassword'].value);

and see what it tells you. If there is a javascript error, you can find 
out what it is from the netscape javascript debug console. Under the 
Tools menu I think.

Adam
sriram wrote:
> I'm not using struts validator package.
> 
> I'm just checking if a mandatory field is null or not using the following code in validate()
function of ActionForm.
> 
> public ActionErrors validate(ActionMapping mapping,
>                                  HttpServletRequest request) {
>         ActionErrors errors = new ActionErrors();
> 	  if( oldPassword == null || oldPassword.length()==0 ){
>             errors.add("oldPassword",new ActionError("error.oldPassword.required"));
>         }
>         return (errors);
> }
> HTML FORM is defined as follows:
> <html:form action="/str/userview_maintpost.do"  focus="oldPassword">
> 
> The SUBMIT image is provided in .jsp page as follows:
> 
>  <html:image src="../images/submit.jpg" border="0" alt="Submit" onclick="preSubmit(this.form,
'New');" property="action"/>
> 
> This is calling a javascipt function 'preSubmit' which is given below:
> 
> 
> function preSubmit(form, action_value)
> {
>   form.lrAction.value=action_value;
>   form.submit();
> } // end of preSubmit
> 
> That's it. This is the code I'm using.
> 
> When I submit the page without providing any input for 'oldPassword' field, it's showing
appropriate message in IE, but not in Netscape. 
> In Netscape, it's simply going to the page specified in Action Forward.
> 
> Any clue why this doesn't work in Netscape?
> 
> 
> 
> 
> 
> -----Original Message-----
> From: Adam Hardy [mailto:ahardy.struts@cyberspaceroad.com] 
> Sent: Monday, July 07, 2003 7:36 PM
> To: Struts Users Mailing List
> Subject: Re: Validate() in netscape
> 
> 
> sriram wrote:
> 
>>I'm using Netscape 4.7
>>
>>And the erors here are not javascript.
>>Simple validations performed in validate() method of ActionForm.
>>
>>I'm using an image in place of a submit button (using <html:image> 
>>tag).
>>
>>In case value is not provided for a mandatory field, the validate() 
>>method will chk for null and return an error. This error is shown in 
>>IE but not in Netscape.
>>
>>What could be the reason? Doesn't netscape support form submission 
>>through <html:image> tags?
> 
> 
> Oh I see. If netscape didn't support html:image tags as submit-triggers, 
> then you wouldn't be able to submit to the server. So what you mean is 
> that when submitting from netscape, a field that should fail validation 
> actually passes without error?
> 
> Are you using struts-validator plugin?
> 
> What validation test are you doing? Show us some code, maybe it's the java.
> 
> What is the value of the field that should fail the validation? Try 
> logging it or System.out.println
> 
> 
> Adam
> 
> 
> ---------------------------------------------------------------------
> 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


Mime
View raw message