It didn't work because you're saying 'set this hidden field to the value the user hasn't entered yet':

  <s:textfield label="..." name="acc.firstName" id="fn" />
  <s:hidden name="acc.lastName" value="${fn}" />

In other words, what that says is 'set the value of the acc.lastName input to the value acc.firstName has when the form is rendered'. The value submitted for acc.lastName would therefore be the original (pre-form-submit) value of accc.firstName.

You'd have to either use Javascript to keep the acc.lastName input's value in sync with what the user enters or, as mentioned previously, take care of this in the action (which is the proper thing to do since this requirement isn't a presentation issue.)

L.

Mansour wrote:
Yes, I am going to do this in my action. But out of curiosity, I would like to know how to do this. I tried what you did (in my original post) and didn't work.


Ed Griebel wrote:
You should probably be doing this in your action class, not your JSP.
If it should always be set to acc.firstName, then you could just
hardcode a hidden field: <input type="hidden"
value="${acc.firstName}"/>

On 5/18/07, Mansour <[EMAIL PROTECTED]> wrote:
how to populate 2 fields in my action with one value ?
for example I need to populate the first name and last name with one
value for searching:

<s:form action="searchAccount" method="post" theme="xhtml" >
<h4> Search Account </h4>
<s:textfield label="id" name="acc.id" />
<s:textfield label="AccountName Contains" name="acc.firstName" id="fn" />
<s:hidden name="acc.lastName" value="${fn}" />
....



I tried this. This is not working.
Thanks



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to