struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Van Wart <sc...@indosoft.com>
Subject Re: Question about Lookup dispatch action
Date Fri, 18 Aug 2006 21:47:35 GMT
mosho wrote:
> Hi Scott,
>
> It doesn't seem to work.
>
> My submit buttons look like this:
> <html:submit property="navigation" value="Previous" styleClass="button" >
>               <bean:message key="button.previous"/>
> </html:submit>&nbsp;&nbsp;&nbsp;
>
> Now, if I have a link, how can I set the property navigation for it.
> "  onClickSubmit()  pic.gif   "
>   

Well first you should probably get rid of 'value="Previous"', since you 
should be (and are) setting the button text using <bean:message.../>.

I didn't consider you were using regular buttons as well.  In this case, 
the hidden field is going to be sent, and might muck up 
LookupDispatchAction when the user clicks a regular button.  So what you 
might need to do is something like this:

  <input type="hidden" id="hiddenNavigation" name="navigation" value="" 
disabled>

I can't guarantee having the "disabled" there will work, but it should 
prevent the web browser from sending an extra (blank) "navigation" 
property and possibly causing the bean helpers to discard the REAL 
"navigation" value (when a button is clicked).  Then in your JSP:

  <c:set var="submitText">
    <bean:message key="button.submit" />
  </c:set>

  <script type="text/javascript">

    function onClickSubmit() {
      var hiddenField = document.getElementById( "hiddenNavigation" );
      hiddenField.disabled = false;
      hiddenField.value = "${submitText}";
      document.navigationForm.submit();
    }

  </script>

Have fun,
  Scott

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


Mime
View raw message