Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

want form submitted automatically

Status
Not open for further replies.

legos

Programmer
Jul 2, 2003
151
US
I have a form and instead of the user pressing a button, I want the form to submit automatically.
Here is what I have so far:
Code:
<form ACTION="[URL unfurl="true"]http://www.cybernations.net/compose2.asp?Nation_ID=3150"[/URL] METHOD="POST" name="FrontPage_Form1" language="JavaScript">
                            <div align="center">
                            <table width="100%" 
                              border=1 cellpadding=5 cellspacing=0 colspan="2" bordercolor="#000080">
                              <tbody>
                                <tr bgcolor="5E6C50" class=colorformheader> 
                                  <td colspan=2 bgcolor="#000080">
                                  <p align="left"><font color="#FFFFFF"><font class=textsize9><b>&nbsp;:. Compose 
                                    A Message To New Reverie ruler of (New Reverie)</font></td>
                                </tr>
                                <tr class=colorformfields> 
                                  <td align=right width="31%"><font 
                                class=textsize9>To Nation / Member Id:</font></td>
                                  <td width="69%"><font class=textsize9> 

	 New Reverie (New Reverie)
<input type=hidden name="messaging_toid" value="New Reverie">
                                 &nbsp;</font></td>
                                </tr>
                                    <tr class=colorformfieldsalt> 
                                      <td align=right width="31%"><font 
                                class=textsize9>Subject</font></td>
                                      <td><font class=textsize9> 
                                        &nbsp;<input 
                                name=messaging_subject class=inputFieldIE value="To all LOSS members" size=50 
                                maxlength=50>
                                        <input name="from" type="hidden" id="from2" value="New Reverie">
                                        </font></td>
                                    </tr>
                                    <tr class=colorformfields> 
                                      <td align=right width="31%" valign="top"><font 
                                class=textsize9>Message</font></td>
                                      <td><font class=textsize9> 
                                        &nbsp;<input name=messaging_message class=inputFieldIE value="This is a test of the emergency broadcast system. This is only a test." rows=10 cols=50>
                                        </font></td>
                                    </tr>
                                <tr class=colorformfields> 
                                  <td align=right colspan=2><div align="center">&nbsp;</div>
									<div align="center"><font class=textsize9> 
                                      <input name=submit2 type=submit class=Buttons id=submit2 value="Send Message">
                                      	<br>
&nbsp;</font></div></td>
                                </tr>
                              </tbody>
                            </table>
                            </div>
                            <input type="hidden" name="MM_insert" value="form1">
                          </form>
I want to remove or modify these lines so that when the form is opened it just submits once it gets to this point instead of having the user press the send message button.
Code:
<tr class=colorformfields> 
                                  <td align=right colspan=2><div align="center">&nbsp;</div>
									<div align="center"><font class=textsize9> 
                                      <input name=submit2 type=submit class=Buttons id=submit2 value="Send Message">
                                      	<br>
&nbsp;</font></div></td>
                                </tr>

Durible Outer Casing to Prevent Fall-Apart
 
Will you be asking the users to enter any information within your controls - Message and the Text?

You can have a onBlur event on the textarea and that would submit the form without having to click on the submit button.
 
No the text will already be applied. I just want the form to submit each time it is opened.

Durible Outer Casing to Prevent Fall-Apart
 
OK, i've managed to simplify my form a bit and added some JS to submit what I want.

Code:
<form ACTION="[URL unfurl="true"]http://www.cybernations.net/compose2.asp?Nation_ID=3150"[/URL] METHOD="POST" name="FrontPage_Form1" >

<input type="hidden" name="messaging_toid" value="">
<input type="hidden" name=messaging_subject value="" >
<input type="hidden" name="from" value="">
<input type="hidden" name=messaging_message value="" >
<input type="hidden" name="MM_insert" value="">           
            
</form>
<script type="text/javascript" language="JavaScript"><!--
document.FrontPage_Form1.messaging_toid.value = "New Reverie";
document.FrontPage_Form1.messaging_subject.value ="To all LOSS members";
document.FrontPage_Form1.from.value  = "New Reverie";
document.FrontPage_Form1.messaging_message.value = "This is a test of the emergency broadcast system. This is only a test.";
document.FrontPage_Form1.MM_insert.value = "form1";
document.FrontPage_Form1.submit(); 
//--></script>

now the only problem is when I open it my browser gives me a warning because of the java script trying to execute. Is there a way to do the same thing as the <script></script> part of this code is trying to do without getting a security warning?

Durible Outer Casing to Prevent Fall-Apart
 
Are you running this file from your local machine, or on an intra/internet? If it's from your local machine, then it is a security "feature" that MS added with SP2 for xp. Follow this link to find out what option to turn off so you don't see the annoying message anymore:


-kaht

[small](All puppies have now found loving homes, thanks for all who showed interest)[/small]
 
That takes care of it, thanks!

Durible Outer Casing to Prevent Fall-Apart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top