Solved

Manipulating a jsp form via a different form

Posted on 2003-11-25
5
298 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 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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

A look at what happened in the Verizon cloud breach.
Part One of the two-part Q&A series with MalwareTech.
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

623 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