You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by rapsy <ro...@gmail.com> on 2006/12/14 18:38:50 UTC

Dynamic form field

Hi 

I have a requirement to generate dynamic fields on form page depending on a
value that user has entered.

If user has entered value = 3, I have to generate 3 check boxes and 3 text
boxes on a form page.
I am able to do this but the problem is if I enter something on that page
and navigate to next page and come back again to that page. It is putting
garbage value in the text box and and not checking any box that I have
checked.

I have stored these text box and check properties as arrays in the action
form.

Please, let me know how can struts handle this.

Thanks!
-- 
View this message in context: http://www.nabble.com/Dynamic-form-field-tf2822296.html#a7877365
Sent from the Struts - User mailing list archive at Nabble.com.


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


Re: Dynamic form field

Posted by Martin Gainty <mg...@hotmail.com>.
Roshini-http://struts.apache.org/WW/tag-syntax.htmlshows how you can dynamically construct your textfield as in<s:textfield label="%{getText("postalCode.label")}" name="postalCode"/>The best example is to use org.apache.struts2.showcase.model.Employee which implements IDEntity with the individual attributes you desireand then reference the employee from your Action classorg.apache.struts2.showcase.action.EmployeeAction.prepare() method with getEmployee() / setCurrentEmployee methodsHTH,Martin----------------------------------------------------------------------------- 
This e-mail message (including attachments, if any) is intended for the use of the individual or entity to which it is addressed and may contain information that is privileged, proprietary , confidential and exempt from disclosure. If you are not the intended recipient, you are notified that any dissemination, distribution or copying of this communication is strictly prohibited.
----- Original Message ----- 
From: "rapsy" <ro...@gmail.com>
To: <us...@struts.apache.org>
Sent: Thursday, December 14, 2006 12:38 PM
Subject: Dynamic form field


> 
> Hi 
> 
> I have a requirement to generate dynamic fields on form page depending on a
> value that user has entered.
> 
> If user has entered value = 3, I have to generate 3 check boxes and 3 text
> boxes on a form page.
> I am able to do this but the problem is if I enter something on that page
> and navigate to next page and come back again to that page. It is putting
> garbage value in the text box and and not checking any box that I have
> checked.
> 
> I have stored these text box and check properties as arrays in the action
> form.
> 
> Please, let me know how can struts handle this.
> 
> Thanks!
> -- 
> View this message in context: http://www.nabble.com/Dynamic-form-field-tf2822296.html#a7877365
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>