Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Manipulating a jsp form via a different form

Posted on 2003-11-25
5
Medium Priority
?
301 Views
Last Modified: 2010-04-01
Hi,
I have a Main.jsp that includes an iframe tag.
The iframe includes a frame.jsp file.

Main.jsp :

<iframe name = "jspFrame" height="150" width="800" marginheight="10" marginwidth="10"  frameborder="1"   scrolling="auto" > > </iframe>

<script>
setFrame();
function setFrame(){
var taskConfigFrame = document.getElementById('jspFrame');
            taskConfigFrame.setAttribute('src', 'frame.jsp');
}
</script>

How can I call a javascript function in frame.jsp or perform a submit to the frame.jsp if all I have is a submit button of the Main.jsp?
All actions I want to do via the Main.jsp, I don't want to create a submit button in frame.jsp.
Please advise
Thanks
Jo

0
Comment
Question by:YossiBa
  • 3
  • 2
5 Comments
 
LVL 14

Expert Comment

by:kennethxu
ID: 9822115
you can use submit button to submit the form in frame or form in main. but not both.
to submit the form in iframe:

NS 6.2 +

  window.frames['ifMyIFrame'].document.frmSubmit.submit();

IE 5.0 +

  document.ifMyIFrame.frmSubmit.submit();
0
 

Author Comment

by:YossiBa
ID: 9822841
Hi,
After using the following in Main.jsp:

taskConfigFrame = document.getElementById('jspFrame');
            taskConfigFrame.setAttribute('src', 'frame.jsp');

I used:
  taskConfigFrame.document.forms[0].submit();

and it does the work, it submit the iframe (frame.jsp) but...

the submit in the frame.jsp is a s follows:
<input type="submit" onclick="setSaveWasClicked('true');"/>
and i need to use the function setSaveWasClicked() when submitting the form but when I submit from Main.jsp it only do a submit without going through the function.

How can I do a submit with using onclick function?
Thanks
0
 

Author Comment

by:YossiBa
ID: 9823200
Hi kennethxu,
remove the last mail that I sent from the protocol.
What I wrote does not submit the iframe.I couldn't understand  document.ifMyIFrame.frmSubmit.submit();

I want after pressing the submit button in Main form I have a function that should submit the frame.
If the frame id is "frameForm", how the submit command should be?
please advise
thanks
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9826240
>> the submit in the frame.jsp is a s follows:
>> <input type="submit" onclick="setSaveWasClicked('true');"/>
then, you should actually be calling the function instead of simpley submitting the form:
taskConfigFrame.setSaveWasClicked('true');
0
 
LVL 14

Accepted Solution

by:
kennethxu earned 400 total points
ID: 9826256
sorry you'll still need to submit it after function call:
taskConfigFrame.setSaveWasClicked('true');
taskConfigFrame.frameForm.submit();
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this post, I will showcase the steps for how to create groups in Office 365. Office 365 groups allow for ease of flexibility and collaboration between staff members.
Aerodynamic noise is the cause of the majority of the noise produced by helicopters. The inordinate amount of noise helicopters produce is a major problem in the both a military and civilian setting. To remedy this problem the use of an aerogel coat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

877 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