Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Manipulating a jsp form via a different form

Posted on 2003-11-25
5
Medium Priority
?
299 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

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

Are you an Exchange administrator employed with an organization? And, have you encountered a corrupt Exchange database due to which you are not able to open its EDB file. This article will explain all the steps to repair corrupt Exchange database.
Check out what's been happening in the Experts Exchange community.
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

722 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