471,338 Members | 1,257 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Parent / Children forms and data

I have an application - an insurance form - which requests personal data on
form one. If the user checks auto or homeowner (or both) on the first form
I need to collect data from each of these (popup?) forms (Auto and HomeOwner
respectively) and then write this collected data to an email message.

Passing selected data to the child forms via the url is possible, but I'm
certain I'd run into a length problem. Since I still have the parent open
then windows.opener.<var>.value is reasonable(??).

Presuming that the user checks both homeowner and auto, after one form is
closed (and we return to the parent) how do I pass this data back to the
parent form?

Session objects (on client side?) appear to be a possible means of passing
data both ways, but I'm not certain from what I've read. Since references
to session variables seems slim - I presume there are better ways. What is
the best <??>, most commonly used way??

When all is said and done - I pass the form to VB ASP script to write the
message (or at least I have done so with several other single page forms).
How do I pass this colloelction of data to something to generate an email
message?

History: I'm an old COBOL / APL / C programmer trying to catch up with the
times, I'm not asking anyone to write code for me - but would surely
appreciate anyone making suggestions and/or pointing me toward appropriate
references.

Thanks //al
Jul 23 '05 #1
4 1940
On Sun, 29 Aug 2004 15:58:35 GMT, Al Jones <al*****@yahoo.com> wrote:
I have an application - an insurance form - which requests personal data
on form one. If the user checks auto or homeowner (or both) on the
first form I need to collect data from each of these (popup?) forms
(Auto and HomeOwner respectively) and then write this collected data to
an email message.
It would be a grave error to make a commerical website dependant upon
pop-ups. Even requested pop-ups are likely to be blocked on some systems,
and the user probably won't realise that they are missing part of the
process.

If the user checks one (or both) of those boxes, the server should
generate an intermediary page that contains the extra fields necessary.
Once they have been filled, the total data set can be passed for final
processing.
Passing selected data to the child forms via the url is possible, but
I'm certain I'd run into a length problem. Since I still have the parent
open then windows.opener.<var>.value is reasonable(??).
window.opener.forms['formName'].elements['elementName'].value

But you shouldn't need to do this, as I described above.
Presuming that the user checks both homeowner and auto, after one form
is closed (and we return to the parent) how do I pass this data back to
the parent form?
One possible way is to get the user to click on a button which writes the
data back, the closes the window. However, what if the user just closes
the window (users do these things)? The data will be lost. An alternative
would be attach change listeners to all the fields that would write the
data back.

The server-side approach is looking more and more appealing...
Session objects (on client side?) appear to be a possible means of
passing data both ways, but I'm not certain from what I've read.
It certainly shouldn't be relied upon. The user can disable cookies.
Cookie data is also limited in size.
Since references to session variables seems slim - I presume there are
better ways. What is the best <??>, most commonly used way??
I would store the data in a database temporarily, giving each user a
unique session id (either stored in a cookie, or in the URL). The
intermediary step I described can add to this data, if necessary.
Alternatively, you could write the data back to intermediary page as
hidden form inputs.

There may well be better approaches, though.
When all is said and done - I pass the form to VB ASP script to write
the message (or at least I have done so with several other single page
forms). How do I pass this colloelction of data to something to generate
an email message?


Most form mail scripts take POST request data and write out the data as
form control name/value pairs. You could either modify such a script to
pull data from the database (if you choose that option), or submit it all
straight to the mail script.

I would say that this question is more appropriate in an ASP group. They
are:

microsoft.public.dotnet.framework.aspnet
microsoft.public.dotnet.framework.aspnet.webservic es
microsoft.public.inetserver.asp.components
microsoft.public.inetserver.asp.db
microsoft.public.inetserver.asp.general

Good luck,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
"Al Jones" <al*****@yahoo.com> skrev i meddelandet
news:L2*******************@news.easynews.com...
I have an application - an insurance form - which requests personal data on form one. If the user checks auto or homeowner (or both) on the first form I need to collect data from each of these (popup?) forms (Auto and HomeOwner respectively) and then write this collected data to an email message.

Passing selected data to the child forms via the url is possible, but I'm
certain I'd run into a length problem. Since I still have the parent open
then windows.opener.<var>.value is reasonable(??).


<snip>

Depending on the browser versions you need to support - how about <span>ing
whatever form elements are required for the homeowner/auto data, and showing
the <span> only if the corresponding checkbox is checked? (by adjusting the
<span>'s style.display/style.visibility)

Joakim Braun
Jul 23 '05 #3

"Joakim Braun" <jo**********@jfbraun.removethis.com> wrote in message
news:ZR*****************@nntpserver.swip.net...
"Al Jones" <al*****@yahoo.com> skrev i meddelandet
news:L2*******************@news.easynews.com...
I have an application - an insurance form - which requests personal data on
form one. If the user checks auto or homeowner (or both) on the first

form
I need to collect data from each of these (popup?) forms (Auto and

HomeOwner
respectively) and then write this collected data to an email message.

Passing selected data to the child forms via the url is possible, but I'm certain I'd run into a length problem. Since I still have the parent open then windows.opener.<var>.value is reasonable(??).


<snip>

Depending on the browser versions you need to support - how about

<span>ing whatever form elements are required for the homeowner/auto data, and showing the <span> only if the corresponding checkbox is checked? (by adjusting the <span>'s style.display/style.visibility)

Joakim Braun

Would you elucidate please....
Jul 23 '05 #4
On Sun, 29 Aug 2004 17:08:50 GMT, Al Jones <al*****@yahoo.com> wrote:

[snip]
Depending on the browser versions you need to support - how about
<span>ing whatever form elements are required for the homeowner/auto
data, and showing the <span> only if the corresponding checkbox is
checked? (by adjusting the <span>'s style.display/style.visibility)

I'd recommend either grouping the elements in a DIV, or hiding the
elements directly. A SPAN just adds bulk.

It also might be a good idea to disable the elements as well as hide them.
If the browser doesn't support the style object, at least it will stop a
user entering values by mistake.
Would you elucidate please....


One of the CSS properties introduced in the second version of the
specification was visibility. It, along with display (introduced in
version one), allows elements to be hidden. With recent browsers, it's
possible to alter the visible state dynamically using the style object.

The difference between an element hidden by visibility and an element
hidden by display, is that the former affects layout; the browser
allocates space but doesn't render the element or its content. The latter
collapses the space used; it's as though the element wasn't there at all.

For example,

<body onload="initialiseForm()">

<!-- other page elements -->

<form ... id="myForm">
<label for="auto">Automobile:
<input id="auto" name="auto" type="checkbox"
onclick="toggleAuto(this.form, this.checked)"></label>
<!-- other form elements -->
<input ... id="myInput">
</form>

<!-- other page elements -->

</body>
function displayElement(o, d) {
if(o.style) {o = o.style;}
o.display = d ? '' : 'none';
}

function initialiseForm() {
var f = document.forms['myForm'];

displayElement(f.elements['myInput'], false);
/* Hide other dependant elements. */
}

function toggleAuto(f, d) {
displayElement(f.elements['myInput'], d);
/* Toggle other elements dependant upon 'auto'. */
}

If you search the archives, you'll find more complete examples.

I admit that I forgot about this when I wrote my first reply. I still
think a server-side solution would be more reliable.

Hope that helps,
Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Ian | last post: by
reply views Thread by Karthick Kumar | last post: by
4 posts views Thread by Danny Tuppeny | last post: by
6 posts views Thread by Edwinah63 | last post: by
8 posts views Thread by Rick | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.