• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to carry the values to the form

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,
currently i am developing small web app. Here comes the requirement.
I have a user input screen with 2 textboxes and 1 dropdown.And it has 2 buttons called Add and Update
both buttons will navitage to same scrren.

Once the user clicks on ADD button i have to do some validations like, make sure the three filelds combination should not exist in the table, if it passes the validationm i am dispalying a screnn which contains textboxes.

Once the user clicks on UPDATE button, i have to validate to make sure should exist in the table, If it passes the validation i am navigationg to the next screen, which is same as ADD Screen, as a difference, all the textboxe values are prepopulateed with the existing data. This i s my requirement.

But the problems, at any point of time one button is carrying the parameters to the action,
how to carry the values to action. i am using struts. Here is my first JSP.

if i click on ADD i am able to pass these values to Action, but if i click on Update i am getting nulls in Action




if the user clicks on ADD button in the first scrren and navigates to the second scrren, on which we have 2 buttons called COnfirm ADD and Confirm Update. I have to disable the ConfirmUpdate button, vice versa to ConfirmAdd buuton is be disable when user come thru update button in the firs scren. How to achieve this.

Any help is greatly appreciated.

Thanks
 
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to check how you have used your form tags. Your elements are wrapped in one form tag and you have update button in another form tag. Hope that gives you a pointer on what you need to do.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to post Struts questions in the Struts forum. I have moved this there for you.
 
Revanth reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Sunil Vasudevan wrote:You need to check how you have used your form tags. Your elements are wrapped in one form tag and you have update button in another form tag. Hope that gives you a pointer on what you need to do.


Thanks for your time, i even tried with one form button, still the same...
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did not get what you meant by 1 form button.

You need two buttons - Add and Update. But they should be within one single form element. On the click on the button, your server should be able to understand if the request is for Add or Update.

Can you attach your form bean and action class?
 
Revanth reddy
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your time Sunil. I found out a solution for that. Using a java script.. i am assigning an action to each button.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic