dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 7 of 7

Thread: How to take variable from dynamic field

  1. #1
    Join Date
    Apr 2007
    Posts
    5

    How to take variable from dynamic field

    I have select field:
    1:
    <select onChange="Get1(this.options[this.selectedIndex].text)" id="1" name=1>
    <option value="" selected>...Please wait...</option>
    </select>
    2:
    <select onChange="Get2(this.options[this.selectedIndex].text)" id="2" name=2>
    <option value="" selected>...Please wait...</option>
    </select>
    2:
    <select id="2" name=2>
    <option value="" selected>...Please wait...</option>
    </select>
    First (1) and second (2) changes dynamicly then update third field (3). When update third field I need information (selected data) on fierst field. How I can take variable from first field?

    Best regards,
    Alex

  2. #2
    Join Date
    Apr 2007
    Location
    Sunny Adelaide
    Posts
    13
    document.getElementById('1').value
    Brevitywit

  3. #3
    Join Date
    Apr 2007
    Posts
    5
    Penagate: Thanks. I know this construction. But I need to take variable from select field in php script where send data all form. How I get it in php script? I know that is simple. But this is my "stumbling block". Please, help me!!!

    Alex

  4. #4
    Join Date
    Apr 2007
    Location
    Sunny Adelaide
    Posts
    13
    $_GET['1'] or $_POST['1'], depending on the method specified in your form element.

    If you need to make more than one round trip just to update all of the fields than I suggest you re-think your logic.


    Regards

    - P
    Brevitywit

  5. #5
    Join Date
    Apr 2007
    Posts
    5
    I've try to use this:
    <script>
    function Get1()
    {
    1Box = document.getElementById("1");
    }
    </script>

    and changes second field to:
    <select onChange="Get3(this.options[this.selectedIndex].text+Get1())" id="2" name=2>

    I think that variable 1 add to variable 2 and in result I'll have massive $2 which I take with $_POST. But this is don't work.. Why?

  6. #6
    Join Date
    Apr 2007
    Location
    Sunny Adelaide
    Posts
    13
    Why are you adding them all together?
    There is no need to do that. If need be, you can join the field values on the server-side.

    Can you explain what you're trying to do? There is undoubtedly a better way.
    Brevitywit

  7. #7
    Join Date
    Apr 2007
    Posts
    5

    ok

    I send you all script in .zip archive. Problem in area.php. Thanks for help.

    Best regards,
    Alex
    Attached Files Attached Files

Similar Threads

  1. dynamic field names in select statement.
    By Lily in forum Database
    Replies: 1
    Last Post: 06-04-2002, 10:49 AM
  2. Replies: 2
    Last Post: 03-13-2002, 10:43 AM
  3. Dynamic naming of a variable...
    By nick in forum Java
    Replies: 1
    Last Post: 02-13-2001, 11:53 AM
  4. creating a dynamic object based upon a variable???
    By Patrick Buchanan in forum ASP.NET
    Replies: 3
    Last Post: 11-29-2000, 01:06 PM
  5. Ted, you're a prince!
    By Georgiana Trigg in forum VB Classic
    Replies: 0
    Last Post: 10-29-2000, 12:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center