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 April 3rd, 2006, 04:11 PM
Cal Learner Cal Learner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 Cal Learner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 39 m 57 sec
Reputation Power: 0
Can Parent Form Submit Button post IFrame Form Data?

There must be a way to do this, but it is beyond my JS understanding.

I have an .asp parent with an embedded Iframe file. The Iframe file consists of a simple form that collects user data for database storage on form submit. I'm OK with all of that... the problem is that the Submit button is in the parent file (not in the Iframe file), and is used first to call the form file into the Iframe, and then I want that same Submit button in the parent file to post the form data out of the Iframe file. I haven't been able to figure out how to specify the Iframe form ID, since the parent file wants to submit the parent form (the one that calls the Iframe form in the first place), rather than the called Iframe form containing user data. Hmmm. Any guidance would be appreciated.

Reply With Quote
  #2  
Old April 4th, 2006, 12:53 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
What's the purpose of the iframe at all? Seems kind of pointless.
Unless there's a purpose, you might be better using an ASP include statement to embed the fields into your main ASP page.

There might be ways with hidden fields on your parent page and a whole pile of javascript to pull DOM from the iframe... but honestly, it's overkill...

I wouldn't mind seeing an example of a page, to have a better idea of what you're trying to accomplish.
__________________
Daryl's Homepage | My Blogroll | My Profile | Firefox supporter!
DevArticles Forum Moderator

"The net is a waste of time, and that's exactly what's right about it." -- William Gibson

Reply With Quote
  #3  
Old April 8th, 2006, 08:44 AM
Cal Learner Cal Learner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 Cal Learner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 39 m 57 sec
Reputation Power: 0
Quote:
Originally Posted by MadCowDzz
What's the purpose of the iframe at all? Seems kind of pointless.
Unless there's a purpose, you might be better using an ASP include statement to embed the fields into your main ASP page.

There might be ways with hidden fields on your parent page and a whole pile of javascript to pull DOM from the iframe... but honestly, it's overkill...

I wouldn't mind seeing an example of a page, to have a better idea of what you're trying to accomplish.


The purpose of the iframe is to hold changeable content. It begins at parent onload with a listing of selected database records displayed in file1.asp. On form submit, the iframe changes to file2.asp, a data input form to collect user info. Then, on form submit, that form data is written to a db and file1.asp is reloaded into the iframe, now displaying the updated records listing. It turns out that the problem of triggering a form submit for a form contained in an iframe from a submit button contained in the parent can be handled by a single line of code in a function called by the submit button:

document.frames.iframeName.document.forms[0].submit();

Thanks for taking the time to respond. Turns out it wasn't pointless after all, eh?

Reply With Quote
  #4  
Old April 10th, 2006, 12:33 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,886 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 19 m 35 sec
Reputation Power: 18
sorry, I didn't mean to call it pointless... (sounds fairly rude, eh? sorry)

Looks like you've found the DOM way to do it, which I was going to point out once I got a better grasp on what you're trying to accomplish.

So the button on the main page has an onclick which submits the iFrame form?
I still don't exactly follow... but it sounds like you've figured it out... and I guess that's what matters most =)

This sounds like a good place to apply AJAX... I'd be careful with relying on Javascript though, of a user has it disabled your whole application is shot.

Reply With Quote
  #5  
Old April 12th, 2006, 02:39 PM
Cal Learner Cal Learner is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 3 Cal Learner User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 39 m 57 sec
Reputation Power: 0
Hey Dzz, sounds like you've got the idea. The submit button in the main page actually does double duty: first it calls the user form into the iframe (because the iframe begins with a tabular report-type listing of database records), then, when the user data fields are filled in, the same button processes the user input into the db and reloads the initial tabular report file, now updated with the user's last input.

I elected to structure the file in that way (with the submit button in the main page, rather than on each of the 2 files which occupy the iframe at different times), because I wanted the submit button to always be visible to the user, rather than having to scroll down the inframe files to find individual, separate submit buttons on each of the content files.

Thanks for the comment in re: AJAX. I'm aware of the JS limitations, but I'm totally unfamiliar with AJAX, and I'm not sure that I'm ready for a brand new learning curve just yet.

Reply With Quote
  #6  
Old April 23rd, 2006, 08:41 AM
ravs ravs is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Location: gurgaon, haryana, india
Posts: 60 ravs User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 44 m 29 sec
Reputation Power: 12
Send a message via Yahoo to ravs
HEY if you want to submit parent form from iframe then use


window.parent.form[x].submit();

have fun
ravs







HEY
















Quote:
Originally Posted by Cal Learner
Hey Dzz, sounds like you've got the idea. The submit button in the main page actually does double duty: first it calls the user form into the iframe (because the iframe begins with a tabular report-type listing of database records), then, when the user data fields are filled in, the same button processes the user input into the db and reloads the initial tabular report file, now updated with the user's last input.

I elected to structure the file in that way (with the submit button in the main page, rather than on each of the 2 files which occupy the iframe at different times), because I wanted the submit button to always be visible to the user, rather than having to scroll down the inframe files to find individual, separate submit buttons on each of the content files.

Thanks for the comment in re: AJAX. I'm aware of the JS limitations, but I'm totally unfamiliar with AJAX, and I'm not sure that I'm ready for a brand new learning curve just yet.

Reply With Quote
  #7  
Old December 16th, 2008, 10:27 PM
noajax noajax is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2008
Posts: 1 noajax User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 m 36 sec
Reputation Power: 0
Wink iFrame or Ajax

AJAX is based on JavaScript and iFrames (Have a look at source when page is rendered)...so if a user disables JavaScript you stuffed anyway.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Can Parent Form Submit Button post IFrame Form Data?


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 - 2018, Jelsoft Enterprises Ltd.

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