Pop-Up Pass Multiple Dynamic Values Between Forms

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

    Pop-Up Pass Multiple Dynamic Values Between Forms

    Hello,

    Thanks for taking a look at this!

    Problem:
    I'm trying to pass multiple dynamic values between a slaveform and a
    masterform. The problem I'm having is on the slaveform I loop through
    multiple records and want two values depending on the row they select.

    slaveform: x=selected
    Radio ID Location
    x 1 1
    2 2
    3 3
    ..
    ..
    ..

    So in the slaveform I want the ID=1 and Location=1 passed back to the
    masterform. Since the row has been selected by selecting the radio
    button. I'm using ASP to loop through the records of the database if
    this makes any difference.

    I would really appreciate an example or suggestions if you guys have
    any.

    Thanks !
  • Vincent van Beveren

    #2
    Re: Pop-Up Pass Multiple Dynamic Values Between Forms

    Hey,

    To return the information you can alway use opener. opener refers to the
    parent document that opened the window. Something like:

    if (opener && !opener.closed && opener.returned Values) {
    opener.returned Values(id, location);
    }

    returnedValues is a function you have to write in the master form.

    Now there are several ways to solve the other problem. You could build
    an additional array, or you could make multiple hidden fields, but I
    would think the following would be the easiest. You could integrate the
    values in the radiobutton. For example, you could do the following:

    <INPUT TYPE="radio" NAME="list" VALUE="1,0"> ID 1, Location 0
    <INPUT TYPE="radio" NAME="list" VALUE="2,1"> ID 2, Location 1
    <INPUT TYPE="radio" NAME="list" VALUE="3,2"> ID 3, Location 2

    Now once you press 'the' button you can do the following

    function sendBackValues( )
    {
    list = document.myform .list;
    for (i=0;list.lengt h;i++)
    {
    if (list[i].checked) {
    if (opener && !opener.closed && opener.returned Values)
    {
    values = list[i].value.split(', ');
    opener.returned Values(values[0], values[1]);
    return;
    }
    }
    }
    alert('No options checked!');
    }

    Good luck,
    Vincent


    cwwilly wrote:[color=blue]
    > Hello,
    >
    > Thanks for taking a look at this!
    >
    > Problem:
    > I'm trying to pass multiple dynamic values between a slaveform and a
    > masterform. The problem I'm having is on the slaveform I loop through
    > multiple records and want two values depending on the row they select.
    >
    > slaveform: x=selected
    > Radio ID Location
    > x 1 1
    > 2 2
    > 3 3
    > .
    > .
    > .
    >
    > So in the slaveform I want the ID=1 and Location=1 passed back to the
    > masterform. Since the row has been selected by selecting the radio
    > button. I'm using ASP to loop through the records of the database if
    > this makes any difference.
    >
    > I would really appreciate an example or suggestions if you guys have
    > any.
    >
    > Thanks ![/color]

    Comment

    • Chad S

      #3
      Re: Pop-Up Pass Multiple Dynamic Values Between Forms

      Hey Vincent,

      Thanks so much for helping me out with this. I have the general idea
      now of what you're suggesting. I am unclear how I should write the
      returnedValues function on the parent document.

      Could you give me just a little more direction ? Thanks !

      Chad

      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      • Vincent van Beveren

        #4
        Re: Pop-Up Pass Multiple Dynamic Values Between Forms

        Sure

        [color=blue]
        > Could you give me just a little more direction ? Thanks !
        >[/color]

        returnedValue is a function you can write yourself. I just thought it
        was a good name, but you can name it 'monkey' if you like. You could
        process the values in the following manner. Depending on what you want,
        you could do anything else with it. This would be a possible implementation


        <script language="JavaS Cript">
        <!--
        function returnedValue(i d, location) {

        f = document.myForm ;
        f.id.value = id;
        f.location.valu e = location;
        }
        <!-- -->
        [...]
        <FORM NAME="myForm" [...]>
        [...]
        <INPUT TYPE="hidden" name="id">
        Location: <INPUT TYPE="text" name="location" >
        [...]
        </FORM>

        I hope it helps,
        Vincent

        Comment

        • Vincent van Beveren

          #5
          Re: Pop-Up Pass Multiple Dynamic Values Between Forms

          Oh, I forgot, naming a name="id" might go wrong, since ID is usually
          already an existent properties of an object. You might better call it
          'theId' or something. And I made a typo in the method name. There should
          be an s at the end of function returnedValues( id, location);

          Vincent van Beveren wrote:
          [color=blue]
          > Sure
          >
          >[color=green]
          >> Could you give me just a little more direction ? Thanks !
          >>[/color]
          >
          > returnedValue is a function you can write yourself. I just thought it
          > was a good name, but you can name it 'monkey' if you like. You could
          > process the values in the following manner. Depending on what you want,
          > you could do anything else with it. This would be a possible implementation
          >
          >
          > <script language="JavaS Cript">
          > <!--
          > function returnedValue(i d, location) {
          >
          > f = document.myForm ;
          > f.id.value = id;
          > f.location.valu e = location;
          > }
          > <!-- -->
          > [...]
          > <FORM NAME="myForm" [...]>
          > [...]
          > <INPUT TYPE="hidden" name="id">
          > Location: <INPUT TYPE="text" name="location" >
          > [...]
          > </FORM>
          >
          > I hope it helps,
          > Vincent
          >[/color]

          Comment

          Working...