File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to show a textfield dynamically using struts..(URGENT)

 
preethi venkatarangan
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone..
I want to know how to show or hide a text filed based on the value selected in a Drop down List.
Say for example i have created a DropDownList which has numbers 1,2,3 using the <html:select> tag &<html ptionsCollection> tag.
Now if i need to display 1 textfield if the user has selected 1 from dropdownlist, 2 textfields if user has selected 2 from the list.

Can someone please help me by providing a sample code.I need it very badly.

Thanks in Advance For your help.
 
rajan Kayarohanam
Greenhorn
Posts: 12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
for this you can write a code in your action such that take the selected value in that dropdown list and based upon that set some boolean value/set some property in the form to 1/2/3/4 which ever you want. and in the JSP you can use <logic:equal name="formName" property="thePropertyyouHaveSetInForm" value="1/2/3/4..."> give the Text box here.</logic:equal>.

Basically you have to get the dropdown list value in your action and based upon that you have to set a property to 1or2or3or4 and can use the logc:equal tag.

Test and let me know if this had helped you... Good Luck!!!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic