Solved

Submit button in other frame

Posted on 1999-01-21
20
219 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Return data with AJAX, JQUERY and PHP 13 56
html coding on my Tumblr blog 1 34
How to Left-Align Navigation bar? 4 8
Centered Image 2 23
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

895 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

18 Experts available now in Live!

Get 1:1 Help Now