JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 1st, 2006, 01:49 PM
SnapCracker's Avatar
SnapCracker SnapCracker is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Location: Kent, United Kingdom
Posts: 165 SnapCracker User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 21 h 22 m 31 sec
Reputation Power: 10
Automatic submit on page load

I have the following code used in a iFrame page which passes on info from a Form on another page(called page 1) to the page (called page 2)within the iFrame page. So, when info is submitted from page 1 via that Form the info is used to display results in page 2.

This is in iFrame page.
Code:
<SCRIPT LANGUAGE="JavaScript">
function fnSubmit() {
  window.document.form2.submit();
  return;
}
</SCRIPT>
</head>



<body  LANGUAGE="javascript" onload="return fnSubmit()">

then a form with hidden inputs in the body


The trouble is that is quite slow and the page 2 first says no results as it loads, then displays the results after. Is there a way to send the info to page 2 before it loads and thus has more of a smooth operation. Thanks in advance to colton22!

Reply With Quote
  #2  
Old July 3rd, 2006, 12:23 AM
colton22's Avatar
colton22 colton22 is offline
\ ^_^ / - *Local Friend*
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2006
Location: near chicago, Illinois
Posts: 469 colton22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 1 h 36 m 37 sec
Reputation Power: 9
Send a message via AIM to colton22 Send a message via MSN to colton22 Send a message via Yahoo to colton22
Lightbulb

Acutally there are several ways to do that something like that...

if you wanted to you could go ahead and have to div tags in your pages, like this...

<DIV ID="page1"></DIV> --IF I understand you correctly, the iframe is in this div
<DIV ID="page2" STYLE="display:none"></DIV> --Whatever DOESNT change have already in here

when the form submits, what ever you want done to the page2 all you have to do is the following code...

function changePages() {
page2.innerHTML="all the page in one string";
page2.innerHTML+="More if you want";
window.document.all.page1.style.display="none";
window.document.all.page2.style.display="inline";
}

therefore it will switch pages without re-contacting the server, and you will still get an "updated" page out of it.

or you could use php and post it, thats harder though, i would recommend posting a thread in there if you wanna do that


next option...
a good one that not many know about...

there is a thing in js --> location.search
what it does is take everything after the .html or .htm
i have an example of this at...
http://www.freewebs.com/colton22/track.html?error
if you wanted to you could set this up to set the textfield values up in a line of string, seperated by special charaters and different symbols, then go to this site...

window.document.location.href=window.document.loca tion+"?"+extrastrings

if you need more help contact me at Colton22@comcast.net

i hope i was of some help

colton22 - http://www.freewebs.com/colton22

Reply With Quote
  #3  
Old January 24th, 2013, 09:42 AM
tazogamer tazogamer is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2013
Posts: 2 tazogamer User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 18 m 57 sec
Reputation Power: 0
Here is a working auto-submit method: when page is loaded, it will the form will be immediately autosubmited (the values can be set with php variables).
Code:
<form action="page.php"  method="post">
<input type="text" name="example1" value="<?php echo $_POST['something1'];?>" />
<input type="text" name="example2" value="ANOTHER_YOUR_VALUE" />
<input type="submit" />
</form>

<SCRIPT LANGUAGE="JavaScript">document.forms[0].submit();</SCRIPT>

for example, the $_POST['something1'] value is received from the previous real-user submited Form, and this form can add another input with ANOTHER_YOUR_VALUE.

_______________________

Reply With Quote
  #4  
Old October 23rd, 2013, 12:26 PM
vipin4u vipin4u is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2013
Posts: 9 vipin4u User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 10 sec
Reputation Power: 0
Try Jquery. It is simpler. You can use documnet.ready function to do it .

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Automatic submit on page load


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap