/    Sign up×
Community /Pin to ProfileBookmark

Usually a frameset file has just the html that defines the frameset. If you were to put other html elements like a form and hidden field in that html, is it possible to refer to the hidden field from a script located in one of the frames the frameset produces?

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisAug 11.2008 — That would not be a valid frameset unless it was within <NOFRAMES> tags.

Try it, and let us know.
Copy linkTweet thisAlerts:
@DayStar56authorAug 12.2008 — First of all, thank you so much for your reply.

Because you asked: I am also using perl. My perl script sends the frameset to the client along with a form and hidden field, which contains data from the server.

When I first wrote this post, I could not get the javascript located in the "TopFrame" of my frameset to access the hidden field data. I did, however, get it to work late yesterday.

Before yesterday the <form tag and hidden field html were physically located below the frameset html. Once I moved it to the location you see below, [B][U]I was able to access it through this line of javascript:[/U][/B] [B]parent.framesetForm.questionStrg.value; [/B]

[B][U]The part of my perl script that creates the frameset and hidden field:[/U][/B]

print <<EOM;

</head>

<form id = "framesetForm">

<input type=hidden id="questionStrg" name="questionStrg" value="$questionStrg">

</form>

</body> (the opening head and body tags are created further up into my perl script through printing a string)


<frameset id="resultsFrame" name="resultsFrame" rows="66.25%,33.75%" frameborder="0" border="0">

<frame scrolling=no SRC="http://localhost/HighScore/Exam460/Sec1/460Sec1_ResultsFrm1.html" id="FrameTop" name="FrameTop">

<frame SRC="http://localhost/HighScore/Exam460/Sec1/460Sec1_ResultsFrm2.html" id="FrameBottom" name="FrameBottom">

</frameset>


</html>

EOM

exit;
Copy linkTweet thisAlerts:
@gil_davisAug 12.2008 — Cool.

Although you got it to work, I must warn you that the <BODY> tag is not vaild HTML in a <FRAMESET>. It will not validate, and may not work in some browsers.

Since a frameset should not contain a <body>, there will also be no document structure. That is probably why it didn't find it to begin with.
Copy linkTweet thisAlerts:
@DayStar56authorAug 13.2008 — Thank you. I see... have you any suggestions?

Please bare with me. What do you mean when you say, "will not validate" ?

[B][U]Further explanation of what I am attempting: [/U][/B]

I am taking a very long string from a hidden field and passing it through the server by way of "post" and then sending it back to the client with the frameset. The string is too big for a client-side cookie (which is what my website would normally use to persist the data.

The page has to be framed (I think, based on my limited knowledge). The top frame has javascript that generates html to the bottom frame based on the data in the string passed through the server.
Copy linkTweet thisAlerts:
@gil_davisAug 13.2008 — What do you mean when you say, "will not validate" ?[/quote]There are free HTML validators that will tell you if your web page is valid W3C compliant HTML. If you want your pages to work reliably (now and in the future), you should follow the recommendations of the W3C. The rules say that <BODY> is not valid syntax if <FRAMESET> is present. You should understand that, being a programmer. That is all I'm saying. Find a valid way to pack your data into the page.

You can write out the string as a var in a script in the head section of the frameset instead of fooling around with a hidden field in a form.

Or, you can put the hidden form in either of the pages that get loaded into the frameset and have a script move the string into the desired field.

If you don't know how to do that, try posting on the perl group for suggestions. I don't know about perl or what is capable of. There may be someone there that knows exactly what you want to do.
Copy linkTweet thisAlerts:
@DayStar56authorAug 13.2008 — As you can tell, I am a work in progress. Still in all, it is nice to be called a programmer. Thanks for playing a part in maturing me. Some day, I hope to have an answer for the next up-in-coming.

Thanks for the advice... well taken... you've helped a lot!

Hungry to learn and feasting in South Carolina :p
×

Success!

Help @DayStar56 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...