Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form submission and iFrame

 
Gert Cuppens
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a JSP with a FORM which includes an iFrame.
This JSP has a button which submits the FORM and all of its elements to the servlet.
Inside the iFrame, I display a list of tours. Each tour has got a radio button with it. The user must be able to check the radio button of one tour if he/she wants to see the details of this tour. With the submit button the user must be able to ask the servlet to show the details for the tour with the checked radio button.

But remember : the submit button is in the form of the JSP, the radio button is in the iFrame.
When I submit the form, I can read the value of the different elements of the <FORM>, but I can�t read the value of the checked radio button. This radio button is in the iFrame (which I have put inside the <FORM> .

My question is : is it possible to read the values of the checked radio button of the iFrame ? Does the submitted FORM communicate the values of every element to the servlet including the values of the iFrame ?
Or is an iFrame considered being completely apart from the FORM ?
[ May 22, 2004: Message edited by: Bear Bibeault ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, the iframe is an entirely separate page, so no form elements within it will be automaticaly submitted with the form.

One thing you could do is to, in an onsubmit handler, use Javascript to read the iframe values and set them onto the form as hidden parameters.

But first I would question the use of the iframe to begin with and replace it with a scrollable div so that there is no separate page to contend with.
 
Gert Cuppens
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the advice, Bear. I didn't even know of the existence of the scrollable div. But since the iFrame gives me a complete other page, it seems much better to use the scrollable div.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64990
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out the overflow CSS rule.

Because this is much more about HTML than JSP, I'm moving this off to the HTML/Javascript forum.

I also edited the title a bit to be a bit more accurate.
[ May 22, 2004: Message edited by: Bear Bibeault ]
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One other thing that you could do is add an onclick handler to the radio button that updates a hiddem form element on the main page

basic idea


Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic