473,804 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JS Function to Insert Values Across Child Frames - Need Help

I'd like the bar.html file to take the values contained in hidden
fields and stuff them into the form fields found on mymessagebox.ht ml.
I can get it working no problem if it is all on the same page, but I'm
having trouble getting it to work across pages via the index.html
frames. Any help is appreciated.

code:

----- application.js -----

function inject_message( ) {
$('messagesubje ct').value = $F('hidden_subj ect');
$('messagebody' ).value = $F('hidden_body ');
}

function clear_message() {
$('messagesubje ct').value = "";
$('messagebody' ).value = "";
}

----- index.html -----

<frameset rows="5%, 95%">
<frame src="bar/bar" name="bar">
<frame src="bar/mymessagebox" name="mymessage box">
</frameset>

----- bar.html -----

<%= javascript_incl ude_tag :defaults %<!-- this loads application.js
-->

<a href='javascrip t:inject_messag e()'>inject me</a| <a
href='javascrip t:clear_message ()'>clear me</a>

<input type="hidden" id="hidden_subj ect" name="hidden_su bject"
value="Hi there"/>
<input type="hidden" id="hidden_body " name="hidden_bo dy" value="My
cool message"/>

----- mymessagebox.ht ml -----

<div>

<div>
<p>Subject:</p>
<div>
<div>
<input type="text" style="width: 450px;" tabindex="1"
id="messagesubj ect" name="messagesu bject"/>
</div>
</div>
</div>

<div>
<p>Body:</p>
<div>
<textarea style="width: 450px;" tabindex="2" id="messagebody "
cols="20" rows="20" name="messagebo dy"/>
</textarea>
</div>
</div>

</div>
Jun 27 '08 #1
3 1378
having trouble getting it to work across pages via the index.html
Whenever you need to save information (state) across pages, you may
find PHP Sessions of help. You can take form data, POST it to server,
and save the values as SESSION variables.
Jun 27 '08 #2
SAM
RoRNoob a écrit :
I'd like the bar.html file to take the values contained in hidden
fields and stuff them into the form fields found on mymessagebox.ht ml.
I can get it working no problem if it is all on the same page, but I'm
having trouble getting it to work across pages via the index.html
frames. Any help is appreciated.
var f1 = parent.mymessag ebox.document.f orms[0];
var f2 = parent.bar.docu ment.forms[0];

f2.messagesubje ct.value = f1.messagehydde n.value;

or something like that (little lost in your code)

--
sm
Jun 27 '08 #3
SAM
venti a écrit :
>having trouble getting it to work across pages via the index.html

Whenever you need to save information (state) across pages, you may
find PHP Sessions of help. You can take form data, POST it to server,
and save the values as SESSION variables.
you can also in JS send variables attached to the url ...

But here it is only a question to send values from window to window (and
their documents) and no help from server is needed

--
sm
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
4303
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table that I need to keep even if they don't have any child records in the MANY table. Below I created...
1
2429
by: cirillo_curiosone | last post by:
Hi, i'm new to javascript. I started studing it on the web few weeks ago, but still haven't been able to solve one big problem: HOT TO PASS VALUES FROM A SCRIPT VARIABLE TO A CHILD HTML GENERATED BY FUNCTION. Here'e the point: I'm writing a simple website for showing my photographs. It has a central page with many links (as many as galleries are).
2
6639
by: Pink Panther | last post by:
Using the following SQL can the results be explained? Using A97 (with the SP2 for Jet 3.5) or A2002 CREATE TABLE Test (PK Number CONSTRAINT PK_TEST PRIMARY KEY, ParentID Number, Child Number); INSERT INTO Test VALUES(1,1,1); INSERT INTO Test VALUES(2,1,2);
4
3633
by: anonymous | last post by:
Thanks your reply. The article I read is from www.hakin9.org/en/attachments/stackoverflow_en.pdf. And you're right. I don't know it very clearly. And that's why I want to understand it; for it's useful to help me to solve some basic problem which I may not perceive before. I appreciate your help, sincerely.
0
1790
by: sandi | last post by:
I have Parent child table as decribe below: Parent Table name = TESTPARENT 1. counter bigint isIdentity=Yes Increment=1 Seed=1 2. customer nChar(10) Child Table name = TESTCHILD 1. counter bigint
1
2979
by: Matik | last post by:
Hey, First, sorry if this post appear twice, because, I can not find my post recently send, trying to post it once again. I'm out of ideas, so, I thought, will search help here again :( I'm trying to prepare a view for ext. app. This is in normal cases very easy, but what if the view structure should be dynamic?! Here is my point (I will siplify the examples).
3
2182
by: news | last post by:
I have a document that can contain any number of iframes which have further copies of the same document (and so on). In practice, we shouldn't ever have frames within frames, but I'd like to make the implementation a general case. Various of the functions in the parent document need to call themselves in the child documents with the same parameters as they've just been passed.
3
3714
by: emlimeng | last post by:
hi everyone, I need help on an error message. I am working on an environment that Access2003 (adp) as a front end and links to SQL server as a back end. I am creating a table, which requests users insert a value(varchar) into the table throuth an input box on a form. Please see the code is below: Public Sub cmdAdd_Click() Dim cmd As ADODB.Command Set cmd = New ADODB.Command Dim getStrUR As String ...
1
2650
by: EJO | last post by:
with sql 2000 enterprise Trying to build a stored procedure that will take the rows of a parent table, insert them into another table as well as the rows from a child table to insert into another table and be able to maintain the relationships between the parent/child rows of the new records. Something like old_id new_id
0
9594
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10350
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10096
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9174
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5534
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4311
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3834
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.