use validation and action in 5 submit buttons in a same page

PLZ PLZ HELP ME OUT ::slight_smile:

i have a form, in which i have one drop down menu and five separate tables which have one text field and a submit button each. By default all the text fields are hidden

when the form is loaded all the tables i have are hidden at initial stage but depending on the value of the drop down menu selected by the user the table get unhide. Upto this part there is no problem

But now the problem arises:- ???

when a table gets unhide depending on the users selection from the drop down menu it have a text field and a submit button present in it.

when the user press the submit button, it will first check the blank validation and then it will go to another page if the text field is not empty. If empty it will set the focus on the text box and disable the drop down menu.

remember that each submit button present in the form will direct to move to another page that will be different from the other submit buttons redirection page.for example:-

i have done some of its part, the table gets unhide depending on the value of the drop down, but while checking the blank validation i got puzzled as the validation works for only one submit button and the other submit buttons present in the form did not check any validation.

This is actually javascript question, not php. You can write a javascript function named say validate(id) in which you would check a field with “id”. And include this function to the onclick event of each button like this:

<input type="submit" name="Submit" value="submit" onclick="javascript:document.form.action='party.php'; validate('text_party');">

Function validate() would trigger some flag (a javascript variable) that would be checked upon form’s onsubmit event:

<form onsubmit="check_submit();">
Sponsor our Newsletter | Privacy Policy | Terms of Service