Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
osheen maen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1599
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"...using action classes not javascript"

Any specific reason? Why would you want to hit server ?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
osheen maen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64629
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic