Jump to content

Submit Code


nummer31

Recommended Posts

<a href="#" onClick="document.getElementById('form1').submit()" style="margin-left:10px">send</a>

i'm used to submitting forms with buttons

<input type="submit" name="button" id="button" value="Submit" />

can smn plz explain me the top codes?

and i can't make the code to work with a form for submitting values

some pointers will be appreciated

Link to comment
https://forums.phpfreaks.com/topic/201096-submit-code/
Share on other sites

<a href="#" onClick="this.form.submit()" style="margin-left:10px">send</a>

ur code doesn't work either

This is the code for the form inside the table

the 'reset' works but the 'submit' doesn't

                                                                                                 <table >
													  <tr>
														<td style="width:136px;" align="right">	
															<br style="line-height:7px">
															Your Full Name Here:<br>
															<br style="line-height:14px">
															Your E-mail Address:<br>
															<br style="line-height:14px">
															Comments & Questions:
														</td>
														<td style="width:13px;"></td>
														<td style="width:169px;">
															<form id="form1" action=""  name="form1" method = "post">
															<div class="form"><input type="text" name="name" id="name"></div>
															<div class="form"><input type="text" name="email" id="email"></div>
															<textarea rows="40" cols="50" name="message" id="message"></textarea><br>
															<br style="line-height:9px">
															<span >
                                                                <a href="#" onClick="document.getElementById('form1').reset()" style="margin-left:52px">clear</a>
                                                                <a href="#" onClick="document.getElementById('form1').submit()" style="margin-left:10px">send</a>
                                                                </span>
															<label>
															<input type="submit" name="Submit" id="Submit" value="Submit">
															</label>
														  </form>
														</td>
													  </tr>
													</table>

Link to comment
https://forums.phpfreaks.com/topic/201096-submit-code/#findComment-1055784
Share on other sites

What happens if you try this:

                                                                                                 <table >
                                            <tr>
                                             <td style="width:136px;" align="right">   
                                                <br style="line-height:7px">
                                                Your Full Name Here:<br>
                                                <br style="line-height:14px">
                                                Your E-mail Address:<br>
                                                <br style="line-height:14px">
                                                Comments & Questions:
                                             </td>
                                             <td style="width:13px;"></td>
                                             <td style="width:169px;">
                                                <form id="form1" action=""  name="form1" method = "post">
                                                <div class="form"><input type="text" name="name" id="name"></div>
                                                <div class="form"><input type="text" name="email" id="email"></div>
                                                <textarea rows="40" cols="50" name="message" id="message"></textarea><br>
                                                <br style="line-height:9px">
                                                <span >
                                                                <a href="#" onClick="document.getElementById('form1').reset()" style="margin-left:52px">clear</a>
                                                                <a href="#" onClick="document.getElementById('Submit').click()" style="margin-left:10px">send</a>
                                                                </span>
                                                <label>
                                                <input type="submit" name="Submit" id="Submit" value="Submit">
                                                </label>
                                               </form>
                                             </td>
                                            </tr>
                                          </table>

The difference is that the submit <a> virtually clicks the submit button. If you then want to hide the submit button, hide it with CSS.

Link to comment
https://forums.phpfreaks.com/topic/201096-submit-code/#findComment-1056118
Share on other sites

What happens if you try this:

                                                                                                 <table >
                                            <tr>
                                             <td style="width:136px;" align="right">   
                                                <br style="line-height:7px">
                                                Your Full Name Here:<br>
                                                <br style="line-height:14px">
                                                Your E-mail Address:<br>
                                                <br style="line-height:14px">
                                                Comments & Questions:
                                             </td>
                                             <td style="width:13px;"></td>
                                             <td style="width:169px;">
                                                <form id="form1" action=""  name="form1" method = "post">
                                                <div class="form"><input type="text" name="name" id="name"></div>
                                                <div class="form"><input type="text" name="email" id="email"></div>
                                                <textarea rows="40" cols="50" name="message" id="message"></textarea><br>
                                                <br style="line-height:9px">
                                                <span >
                                                                <a href="#" onClick="document.getElementById('form1').reset()" style="margin-left:52px">clear</a>
                                                                <a href="#" onClick="document.getElementById('Submit').click()" style="margin-left:10px">send</a>
                                                                </span>
                                                <label>
                                                <input type="submit" name="Submit" id="Submit" value="Submit">
                                                </label>
                                               </form>
                                             </td>
                                            </tr>
                                          </table>

The difference is that the submit <a> virtually clicks the submit button. If you then want to hide the submit button, hide it with CSS.

thank u very much

it works just fine

i copy pasted this part:

<a href="#" onClick="document.getElementById('Submit').click()" style="margin-left:10px">send</a>

and it worked :D

can u plz explain

how'd u figure it out?

 

Link to comment
https://forums.phpfreaks.com/topic/201096-submit-code/#findComment-1056170
Share on other sites

Well, I know that clicking a submit button in a form will submit that form. So, I used the click() function to simulate clicking that submit button. I figured that out a while back when trying to figure out a way to call a JavaScript function that is on one page from another page, usually in a form.

Link to comment
https://forums.phpfreaks.com/topic/201096-submit-code/#findComment-1056212
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.