Solved

Submit button in other frame

Posted on 1999-01-21
20
218 Views
Last Modified: 2010-04-09
I have two frames: Up and Down
In the upper one there is an asp page that consist in a form with a submit button.
What I want is to move the submit button to the other frame.
Can I do it ? ? ? How can I ? ? ?
Thanks
0
Comment
Question by:carflores
  • 11
  • 6
  • 2
  • +1
20 Comments
 
LVL 4

Expert Comment

by:martinag
ID: 1845560
<FORM>
<INPUT TYPE="BUTTON" VALUE="Submit" onClick="parent.Up.forms[0].submit()">
</FORM>

Martin
0
 
LVL 6

Expert Comment

by:PBall
ID: 1845561
And that didn't work?


0
 
LVL 6

Expert Comment

by:PBall
ID: 1845562
oops..hehe..i thought martin's comment was still the question.

that should work :)
0
 
LVL 4

Expert Comment

by:martinag
ID: 1845563
No it shouldn't :-)
It should be
  parent.Up.document.forms[0].submit()

Martin
0
 
LVL 6

Expert Comment

by:PBall
ID: 1845564
Hey, what is that? a trick comment? hehehe.
well, don't do frame much meself.  Show you how much I know about the frame thingy. :)
0
 

Author Comment

by:carflores
ID: 1845565
Thanks Guys, but it doesn't work for me. Maybe I miss something.
With IE4, an error appears: 'parent.up.document' is not an object.
With Netscape 4 nothing happened
There are really 4 frames.
Here is what i Have:

<form>
<img src="images/botonhelp.jpg">  
<img src="images/botondemo.jpg" >
<img src="images/botonhome.jpg" >
<input TYPE="image" src="images/botonprocess.jpg" name="process" onClick="parent.up.document.forms[3].submit()">
</form>
0
 

Author Comment

by:carflores
ID: 1845566
Thanks Guys, but it doesn't work for me. Maybe I miss something.
With IE4, an error appears: 'parent.up.document' is not an object.
With Netscape 4 nothing happened
There are really 4 frames.
Here is what i Have:

<form>
<img src="images/botonhelp.jpg">  
<img src="images/botondemo.jpg" >
<img src="images/botonhome.jpg" >
<input TYPE="image" src="images/botonprocess.jpg" name="process" onClick="parent.up.document.forms[3].submit()">
</form>
0
 

Author Comment

by:carflores
ID: 1845567
Thanks Guys, but it doesn't work for me. Maybe I miss something.
With IE4, an error appears: 'parent.up.document' is not an object.
With Netscape 4 nothing happened
There are really 4 frames.
Here is what i Have:

<form>
<img src="images/botonhelp.jpg">  
<img src="images/botondemo.jpg" >
<img src="images/botonhome.jpg" >
<input TYPE="image" src="images/botonprocess.jpg" name="process" onClick="parent.up.document.forms[3].submit()">
</form>
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 1845568
Are you sure you are typing the frame name correctly (its case sensitive)

instead of parent try top maybe (though I don't think it should work) but ya
never know :)

CJ
0
 

Author Comment

by:carflores
ID: 1845569
Yes...
I didn´t type the frame name correctly .
Now it´s working, but not at all, because I had an onSubmit event in the frame where the form is and this event is not responding anymore....
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 6

Expert Comment

by:PBall
ID: 1845570
Once you called a form submit method directly from a script, the onSubmit event will not be triggered.

Your only solution is to create another function like:

in the page with the form:

function isAllValid()
{
  //this is your onSubmit event handler (i.e. for validation checkings.
}

function submitForm()
{
  if (isAllValid())
    document.form_name.submit();
}

<form name=form_name action=.... method=... onSubmit="return isAllValid()">

Follow Me?

Now, in the other frame, wire the button/link/image, whatever it is like so:
<input type=button value='Submit' onClick='parent.frame_name.document.submitForm()'>

to call the submitForm function.  This way, you still get to run your validation routine and the form will only submit when it is validated.
0
 

Author Comment

by:carflores
ID: 1845571
An error appears:
"Object doesn't support this property or method"

And did what you told me.....

in the frame called doc:

function validarvalores() {
  // for validation checkings.
}

function entrarforma() {
      if (validarvalores())
            document.frmForma.Submit();
}

<FORM NAME="frmForma" METHOD="post" ACTION="trancuentasresp.asp" onSubmit="return validarvalores()">


in the other frame called barra:
<form>
<img src="images/botonhelp.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<img src="images/botondemo.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<img src="images/botonhome.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<input TYPE="image" src="images/botonprocess.jpg" name="process" onClick="parent.doc.document.entrarforma()" WIDTH="131" HEIGHT="19">
</form>
0
 

Author Comment

by:carflores
ID: 1845572
An error appears:
"Object doesn't support this property or method"

And did what you told me.....

in the frame called doc:

function validarvalores() {
  // for validation checkings.
}

function entrarforma() {
      if (validarvalores())
            document.frmForma.Submit();
}

<FORM NAME="frmForma" METHOD="post" ACTION="trancuentasresp.asp" onSubmit="return validarvalores()">


in the other frame called barra:
<form>
<img src="images/botonhelp.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<img src="images/botondemo.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<img src="images/botonhome.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<input TYPE="image" src="images/botonprocess.jpg" name="process" onClick="parent.doc.document.entrarforma()" WIDTH="131" HEIGHT="19">
</form>
0
 

Author Comment

by:carflores
ID: 1845573
An error appears:
"Object doesn't support this property or method"

And did what you told me.....

in the frame called doc:

function validarvalores() {
  // for validation checkings.
}

function entrarforma() {
      if (validarvalores())
            document.frmForma.Submit();
}

<FORM NAME="frmForma" METHOD="post" ACTION="trancuentasresp.asp" onSubmit="return validarvalores()">


in the other frame called barra:
<form>
<img src="images/botonhelp.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<img src="images/botondemo.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<img src="images/botonhome.jpg" WIDTH="111" HEIGHT="19">&nbsp;&nbsp;
<input TYPE="image" src="images/botonprocess.jpg" name="process" onClick="parent.doc.document.entrarforma()" WIDTH="131" HEIGHT="19">
</form>
0
 

Author Comment

by:carflores
ID: 1845574
Oops...

Every time I do a reload of the page, without knowing, I'm inserting the comment again...

I'm sorry........

0
 
LVL 6

Expert Comment

by:PBall
ID: 1845575
My frame stuffs kinda sucks, you might want to try just...
parent.doc.entrarforma() on that INPUT TYPE="image" line.

that might do it.

0
 

Author Comment

by:carflores
ID: 1845576
Yes PBall...
Now it's working, but only with IE4. With Netscape nothing happend.
And I thought that with Netscape was going to be more compatible...
Dou you know why ? ? ?
And when are you goin to answer formally the question ? ? ? So I can grant you for all the help you have giving me.....
Thanks...
0
 
LVL 6

Accepted Solution

by:
PBall earned 150 total points
ID: 1845577
Netscape was gpomg to be more compatible..hehe.
Not clear there.  In netscape you might need that
parent.doc.document.entraforma() instead of just parent.doc.entraforma()

if that's the case, you need to do some browser sniffing before actually calling one method or the other.

ns = navigator.userAgent... I forgot how to sniff browser the old way, most of the time i just do:

ns = (document.layers) ? 1 : 0;
ie = (document.all) ? 1 : 0;

but the two lines above only work on 4.0 browsers, please check on paq in javascript section on browser sniffing or at builder.com, superscripter column, you should find this there.

if (ns)
  parent.doc.document.entraforma();
else
  parent.doc.entraforma();

anyhow..., claiming point.

0
 

Author Comment

by:carflores
ID: 1845578
Thanks again....
0
 

Author Comment

by:carflores
ID: 1845579
It seems like Netscape doesn't recognize the onClick event of the image...
Is it possible? ? ?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now