Parent / Children forms and data

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Al Jones

    #1

    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


  • Michael Winter

    #2
    Re: Parent / Children forms and data

    On Sun, 29 Aug 2004 15:58:35 GMT, Al Jones <aljones@yahoo. com> wrote:
    [color=blue]
    > 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.[/color]

    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.
    [color=blue]
    > 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(??).[/color]

    window.opener.f orms['formName'].elements['elementName'].value

    But you shouldn't need to do this, as I described above.
    [color=blue]
    > 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?[/color]

    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...
    [color=blue]
    > 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.[/color]

    It certainly shouldn't be relied upon. The user can disable cookies.
    Cookie data is also limited in size.
    [color=blue]
    > Since references to session variables seems slim - I presume there are
    > better ways. What is the best <??>, most commonly used way??[/color]

    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.
    [color=blue]
    > 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?[/color]

    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.publi c.dotnet.framew ork.aspnet
    microsoft.publi c.dotnet.framew ork.aspnet.webs ervices
    microsoft.publi c.inetserver.as p.components
    microsoft.publi c.inetserver.as p.db
    microsoft.publi c.inetserver.as p.general

    Good luck,
    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • Joakim Braun

      #3
      Re: Parent / Children forms and data

      "Al Jones" <aljones@yahoo. com> skrev i meddelandet
      news:L2nYc.3596 63$y4.68091@new s.easynews.com. ..[color=blue]
      > I have an application - an insurance form - which requests personal data[/color]
      on[color=blue]
      > form one. If the user checks auto or homeowner (or both) on the first[/color]
      form[color=blue]
      > I need to collect data from each of these (popup?) forms (Auto and[/color]
      HomeOwner[color=blue]
      > 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(??).[/color]

      <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.visibilit y)

      Joakim Braun


      Comment

      • Al Jones

        #4
        Re: Parent / Children forms and data


        "Joakim Braun" <joakim.braun@j fbraun.removeth is.com> wrote in message
        news:ZRnYc.1648 $LV3.4359@nntps erver.swip.net. ..[color=blue]
        > "Al Jones" <aljones@yahoo. com> skrev i meddelandet
        > news:L2nYc.3596 63$y4.68091@new s.easynews.com. ..[color=green]
        > > I have an application - an insurance form - which requests personal data[/color]
        > on[color=green]
        > > form one. If the user checks auto or homeowner (or both) on the first[/color]
        > form[color=green]
        > > I need to collect data from each of these (popup?) forms (Auto and[/color]
        > HomeOwner[color=green]
        > > respectively) and then write this collected data to an email message.
        > >
        > > Passing selected data to the child forms via the url is possible, but[/color][/color]
        I'm[color=blue][color=green]
        > > certain I'd run into a length problem. Since I still have the parent[/color][/color]
        open[color=blue][color=green]
        > > then windows.opener. <var>.value is reasonable(??).[/color]
        >
        > <snip>
        >
        > Depending on the browser versions you need to support - how about[/color]
        <span>ing[color=blue]
        > whatever form elements are required for the homeowner/auto data, and[/color]
        showing[color=blue]
        > the <span> only if the corresponding checkbox is checked? (by adjusting[/color]
        the[color=blue]
        > <span>'s style.display/style.visibilit y)
        >
        > Joakim Braun
        >
        >[/color]
        Would you elucidate please....


        Comment

        • Michael Winter

          #5
          Re: Parent / Children forms and data

          On Sun, 29 Aug 2004 17:08:50 GMT, Al Jones <aljones@yahoo. com> wrote:

          [snip]
          [color=blue][color=green]
          >> 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.visibilit y)[/color][/color]

          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.
          [color=blue]
          > Would you elucidate please....[/color]

          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="initial iseForm()">

          <!-- other page elements -->

          <form ... id="myForm">
          <label for="auto">Auto mobile:
          <input id="auto" name="auto" type="checkbox"
          onclick="toggle Auto(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.

          Comment

          Working...