question on forms and frames

liunx

Guest
Hi,<br />
this is a question that is related to both html and javascript.<br />
<br />
I have a popup page, that uses frames, one at the top, one in the middle and one at the bottom. The middle frame contains the form, along with all the textfields.<br />
<br />
The bottom frame contains an image that acts as a button to submit the form.<br />
<br />
The problem is where do I put the Javascript function to submit the form. I have tried the main index page, the middle frame and the bottom frame, but none work yet. The onclick command attached to the button cant find the function if it is anywhere but the bottom frame, and if it is in the bottom frame, then the function cant seem to find the form to submit,<br />
<br />
any help appreciated,<br />
<br />
<br />
thanks a lot<!--content-->put the validating function in the frame where the Form is and then when then the submit button is clicked call the function e.g<br />
<br />
suppose the frame that has form and js function,its name is formFrame and the validation functions name is ValidateFields()<br />
now when I click the image in the lower frame to submit this line will call the <br />
ValidateFields() function in the formFrame<br />
<br />
onclick="parent.formFrame.ValidateFields()"<!--content-->hi thanks,<br />
but still a problem,<br />
<br />
onclick="parent.form1.submitform()"<br />
<br />
remember i have three frames, a top, middle and bottom<br />
<br />
i have put the above code attached to the image button and the following in the middle frame, where the form is<br />
<br />
function submitform()<br />
{<br />
alert("HELLO");<br />
document.form1.submit();<br />
<br />
}<br />
<br />
however, it still doesnt work, when you refer to 'parent' which frame does this refer to by default, as there are 3?<br />
<br />
thanks a lot<!--content-->it doesn't work because from the code you posted,it looks like you have implemented the suggestion wrongly.<br />
here is your code<br />
<br />
onclick="parent.form1.submitform()"<br />
<br />
it should be like this<br />
<br />
onclick="parent.frameName.form1.submitform()"<!--content-->ok thanks a lot,<br />
its working now,<br />
I was using the name of the form, instead of the reference to the name of the frame,<br />
<br />
<br />
cheers<!--content-->
 
Back
Top