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.
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...
Joined: Mar 05, 2007
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?
Joined: Oct 10, 2008
Thanks for your time Sunil. I found out a solution for that. Using a java script.. i am assigning an action to each button.