Solved

Manipulating a jsp form via a different form

Posted on 2003-11-25
5
293 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 100 total points
ID: 9826256
sorry you'll still need to submit it after function call:
taskConfigFrame.setSaveWasClicked('true');
taskConfigFrame.frameForm.submit();
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to group array of objects ? 5 60
maven project in eclipse 11 57
java cigar challenge 58 204
thymeleaf natural templating vs JSP 2 25
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

20 Experts available now in Live!

Get 1:1 Help Now