*
The moose likes Struts and the fly likes creating dynamic text box on button click using action classes not javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "creating dynamic text box on button click using action classes not javascript" Watch "creating dynamic text box on button click using action classes not javascript" New topic
Author

creating dynamic text box on button click using action classes not javascript

osheen maen
Greenhorn

Joined: Jan 13, 2012
Posts: 4
I want to add text boxes when user clicks on add button .I have searched on Google .But i found the code using JavaScript .I don't want to do this using java script
I want to do this by using action class and struts .i just want to avoid java script .any one can help me .
Akhilesh Trivedi
Ranch Hand

Joined: Jun 22, 2005
Posts: 1526
"...using action classes not javascript"

Any specific reason? Why would you want to hit server ?


Keep Smiling Always — My life is smoother when running silent. -paul
[FAQs] [Certification Guides] [The Linux Documentation Project]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

Seems like a silly thing to do. But you'll need to redisplay the page with the new control added.

JavaScript is the correct tool for this job -- why do you want to avoid it?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
osheen maen
Greenhorn

Joined: Jan 13, 2012
Posts: 4
Because we can disable java script and also i want to know how to do this using action classes .i any one know please tell me .Thank you
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

cool osheen wrote:i want to know how to do this using action classes

Already answered. When the page is redisplayed as the response of the action, add the new elements to the page. What part of that are you having problems with?
osheen maen
Greenhorn

Joined: Jan 13, 2012
Posts: 4
I didn't get your answer.please elaborate it .Anyways thank you replying. please tell me using an example if you can .
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60782
    
  65

No I will not write the code for you. What part do you not understand? If you can't even figure out what it is you need to know, maybe you're not quite ready to tackle this task.
osheen maen
Greenhorn

Joined: Jan 13, 2012
Posts: 4
i just want to know that why this code is not working .


<s:submit name="addMore" value="+Add More" onclick="this.form.add(<s:textfield />)"></s:submit>


when we are able to change the action of the form like this
<s:submit name="Message" onclick="this.form.action='Helllo'></s:submit>
then we can add a new control in the form .please help to understand the logic
 
Don't get me started about those stupid light bulbs.
 
subject: creating dynamic text box on button click using action classes not javascript
 
Similar Threads
Struts 2 action invoke at javascript level
validate form fields using javascript in struts
Ajax call from javascript
JSP and javascript
how can i map different Actionform class to single Action class