Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Auto Submisson
#1
What's Up?

OK, So i have created a script that automaticly submits data, And its working, Well sort of. You see I want the script to be able to submit the data upon the page loading. ( body onload="document.forms.post.submit();"> ) Well you see when I manuly click the submit button it works, But when i use that onload script, The forum sends me to the post new topic section.

Anyone Know Why?

Thanks Bye.
[Image: Scorpion-Sig3.png]
Reply
#2
I'm not sure right now, but did you tried to put the script inside of script tags at the bottom of your page.
Or in the head tags,

Code:
<script langauge="javascript" type="text/javascript">
document.onload = function() {
   form.submit();
}
</script>

edit:

How is your form named, "forms" or "post".
Reply
#3
Quote:How is your form named, "forms" or "post".

Code:
<form name="post" id="Submit" method="post" action="http://www.co.uk/forum/posting.php?mode=reply&t=36001">
<input type="text" value="title here" class="post" tabindex="2" style="width: 450px;" maxlength="60" size="45" name="subject"/>
<textarea onkeyup="storeCaret(this);" onclick="storeCaret(this);" onselect="storeCaret(this);" class="post" tabindex="3" style="width: 450px;" cols="35" rows="15" name="message"/>Description Here</textarea>

I tried it in a <script>, Sorry for being such an idiot but in your script do you replace the form in form.submit(); to what my form name is?

I know I know I'm such a ass.
[Image: Scorpion-Sig3.png]
Reply
#4
First yes. form.Submit(); is to be changed with the name of your form, in your case you would use document.post.Submit();
If javascript is executed before the form it won't work because the form wasn't loaded.
You should install Firebug...
And Firefox has it's own error console which is also useful to view if there is something wrong with your script.

edit:
You should also define value attribute within your input or textarea fields.
Reply
#5
Code:
<script type="text/javascript">
document.onload = function() {
   post.submit();
}
</script>
Still doesn't work, I looked in the error console but no errors with the script. So its because the script is executed before the form has loaded?

** Added, I tried "post.submit();" on a mouseover= event, So i could wait until the page was loaded then submit the script, But it still sends me to the post new topic section, So it must be something to do with the submission.
[Image: Scorpion-Sig3.png]
Reply
#6
(11-08-2009, 12:05 PM)Scorpion Wrote: I tried "post.submit();" on a mouseover= event, So i could wait until the page was loaded then submit the script, But it still sends me to the post new topic section, So it must be something to do with the submission.

OK, this must work for auto submit,
Put this code just before you are closing your </from>
Code:
<script language="javascript" type="text/javascript">
    document.Designer.submit();
</script>

That should submit your form, as for the part when it sends you to New Topic,
I can only assume that something is wrong with the action attribute of your form.
I would nee to see the code that handle the form submit.
Reply
#7
Quote:That should submit your form, as for the part when it sends you to New Topic,
I can only assume that something is wrong with the action attribute of your form.
I would nee to see the code that handle the form submit.

You want to good news or the bad news? Well actually theirs no good news, Still sends me to the new topic page.

Here's the full html script.
Code:
<form name="post" id="Submit" method="post" action="http://www.teamxlink.co.uk/forum/posting.php?mode=reply&t=36001">
<input type="text" value="Title" class="post" tabindex="2" style="width: 450px;" maxlength="60" size="45" name="subject"/>
<body onload="document.forms.post.submit();">
<textarea onkeyup="storeCaret(this);" onclick="storeCaret(this);" onselect="storeCaret(this);" class="post" tabindex="3" style="width: 450px;" cols="35" rows="15" name="message"/>Main Message Here</textarea>
<table width="100%" cellspacing="2" cellpadding="2" border="0">
<input type="submit" value="Submit" class="mainoption" name="post" tabindex="6" accesskey="s"/>
<script language="javascript" type="text/javascript">
    document.post.submit();
</script>
</form>

Im trying to post a thread on a a forum called xlink forums [forget what that forum is about just used it as a testing ground]

One thing after another huh?

Thanks Bye.
[Image: Scorpion-Sig3.png]
Reply
#8
(11-10-2009, 12:00 PM)Scorpion Wrote: Im trying to post a thread on a a forum called xlink forums [forget what that forum is about just used it as a testing ground]

One thing after another huh?

Thanks Bye.

Ok your are trying to post a new thread, not a new reply for another thread, if that's so
you need to change the action in your form to

Code:
http://www.teamxlink.co.uk/forum/posting.php?mode=newtopic&f=55

f=55 is the forum id.
Reply
#9
Quote:'Master of The Universe' pid='26866' dateline='1257880025']

Ok your are trying to post a new thread, not a new reply for another thread, if that's so
you need to change the action in your form to

Code:
http://www.teamxlink.co.uk/forum/posting.php?mode=newtopic&f=55

f=55 is the forum id.

Do you want the good news or the bad news? Well actually their is no good news, It still sends me to the post new topic bit.

One thing after another after another?
[Image: Scorpion-Sig3.png]
Reply
#10
Wait I don't really understand where the form needs to go.
Do you want to send you to post a new thread or post a new reply on a thread.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Auto Click Button Scorpion 1 1,980 11-06-2009, 09:00 PM
Last Post: Gaijin

Forum Jump:


Users browsing this thread: 3 Guest(s)