Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 1st, 2009, 07:34 AM
Authorized User
 
Join Date: Jan 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Retrieve values from a. ASP.NET form located inside an iFrame

I have a site that uses Masterpages. Inside one of the content pages is an iFrame which displays another page and then below the iframe in the content page is a submit button. All pages involved are .aspx pages. I need to check and see if the page inside that iFrame has controls like radiobuttons and checkboxes, and if it does retrieve those values and write them to a cookie so they can be processed, otherwise process as normal.

I have the normal process (if the page in the iframe doesn't have form fields) working. Where I'm falling down is working with the stuff inside an iframe.

How do I go about determining if the page int he iframe has form controls and how do I go about getting their values so I can write them to a cookie for processing once the submit button is clicked
 
Old May 1st, 2009, 07:48 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

You should be able to check if the iframe's document has a form:
Code:
var doc = window.frames["innerFrame"].contentWindow.document; //or code you have now to get this far
var innerForm = document.forms[0];
if (innerForm)
{
  //read innerForm.elements and add to cookie
  //or create hidden elements on main page to store values 
}
__________________
Joe
http://joe.fawcett.name/
 
Old May 1st, 2009, 04:27 PM
Authorized User
 
Join Date: Jan 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Coolness!

Nice one! Works a treat! Thank you very much!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Using ASP and XMLDOM -can't retrieve values mussitsch XML 2 January 21st, 2009 04:14 PM
values from one iframe to another iframe URGENT raaj Beginning PHP 2 February 27th, 2007 12:19 PM
Passing Form Values in ASP.Net sankar General .NET 10 September 21st, 2006 11:13 AM
refresh other form inside frame. (ASP.NET C#) richie86 ASP.NET 1.0 and 1.1 Basics 1 December 1st, 2005 02:18 PM
set ASP variable values inside Javascript crmpicco HTML Code Clinic 1 March 9th, 2005 12:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.