I have 5 form in a page with 1 submit button in the last form. if i click the submit button it will send all form, start from the first form.

it must be send from the first form, could not random send.

please help me, im newbie on drupal. thanks

Comments

jaypan’s picture

You need to give each submit button a different identifier. For example:

Form 1: $form['submit1'] = array('#type' => 'submit', '#value' => t('Submit 1'),)
Form 2: $form['submit2'] = array('#type' => 'submit', '#value' => t('Submit 2'),)

Contact me to contract me for D7 -> D10/11 migrations.

exxocette’s picture

there is only 1 submit button on the last form, the other form dont have button.

jaypan’s picture

I don't understand what you are asking then.

Contact me to contract me for D7 -> D10/11 migrations.

exxocette’s picture

ah ok, i will give you real example.

I got a page with 4 form. it cannot be change. always like this

there are 3 form without submit, actually they have button but i hide them becouse i want 1 submit button, not 4.

this is form 1st html, 2 other have samiliar script with this one :

<form id="nice-form" method="post" accept-charset="UTF-8" action="/nice/?q=node/96">
<div><p>t1</p>
<div class="form-item">
 <label>Choose one: </label>
 <div class="form-radios">
<table>
<tbody>
 <tr class="multichoice_row odd"><td width="35"><div id="edit-tries[answer]-1-wrapper" class="form-item">
 <label for="edit-tries[answer]-1" class="option"><input type="radio" class="form-radio" value="1" name="tries[answer]" id="edit-tries[answer]-1"/> </label>
</div>
</td><td><p>j1</p>
</td> </tr>
 <tr class="multichoice_row even"><td width="35"><div id="edit-tries[answer]-2-wrapper" class="form-item">
 <label for="edit-tries[answer]-2" class="option"><input type="radio" class="form-radio" value="2" name="tries[answer]" id="edit-tries[answer]-2"/> </label>
</div>
</td><td><p>j2</p>
</td> </tr>
</tbody>
</table>
</div>
</div>
<input type="hidden" value="form-d99453226e5bf574a479449d07be4286" id="form-d99453226e5bf574a479449d07be4286" name="form_build_id"/>
<input type="hidden" value="5b6eb62fb72d7e8b7234a23671b6ba4a" id="edit-nice-form-form-token" name="form_token"/>
<input type="hidden" value="nice_form" id="edit-nice-form" name="form_id"/>
</div></form>

and this the last form html :

<form id="nice-form-3" method="post" accept-charset="UTF-8" action="/nice/?q=node/96">
<div><p>t4</p>
<div id="edit-tries-wrapper" class="form-item">
 <label for="edit-tries">Answer: </label>
 <div class="resizable-textarea"><span><textarea class="form-textarea resizable textarea-processed" id="edit-tries" name="tries" rows="15" cols="60"/><div class="grippie" style="margin-right: -2px;"/></span></div>
 <div class="description">Enter your answer here. If you need more space, click on the grey bar at the bottom of this area and drag it down.</div>
</div>
<input type="submit" class="form-submit" value="Submit" id="edit-submit" name="op"/>
<input type="hidden" value="form-38a1b906824cd1b448f36416bd4f3150" id="form-38a1b906824cd1b448f36416bd4f3150" name="form_build_id"/>
<input type="hidden" value="5b6eb62fb72d7e8b7234a23671b6ba4a" id="edit-quiz-question-answering-form-form-token-3" name="form_token"/>
<input type="hidden" value="nice_form" id="edit-nice-form-3" name="form_id"/>

</div></form>

is it imposible to send them once time ? i don't any idea to proccess them :(

jaypan’s picture

The HTML doesn't really help. Can you show the function that you are using to generate the form?

Contact me to contract me for D7 -> D10/11 migrations.

exxocette’s picture

actually i dont know where the function to create this form. I just know the result ^ ^.

you can imagine 4 form :









submit button only in form4, on the others form the button has hidden, becous i just want 1 button.
it easy for me to submit those form once time with codeigniter, but for drupal, i dont have idea.

I think it must use javascript or ajax to submit them once time

jaypan’s picture

Sorry, unless you can figure out where the form is being generated from, there isn't really any way to help you.

Contact me to contract me for D7 -> D10/11 migrations.