• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Form submission and iFrame

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Sheriff
Posts: 67556
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67556
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
I am Arthur, King of the Britons. And this is a tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic