Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Dec 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    FAcing difficulty in retreiving a selected option value.

    Hi,
    I am using following code--
    Code:
    <td>
    <centre>
    <select id=\"extenddays\"  size=\"1\" name=\"extenddays\">
    <option value\=\"2\"> 2 </option>
    <option value\=\"4\"> 4 </option>
    <option value\=\"7\"> 7 </option>
    </select>
    <a href=?ext_days=\"extendform.extenddays.value\" & ?extfid=" . $data->{'fid'} ." \" >
    <INPUT TYPE=\"SUBMIT\" NAME=\"extend\" VALUE=\"extend\" />
    </a>
    </centre>
    </td>
    Here, I want that when I click on 'extend' button, it should redirect to the url given in the href.. But while forming url run time , it is not retrieving the value of "extenddays" ( which is selected option value)..

    Please help.

    Cheers,
    Shashikant Shinde
    Last edited by Kor; 12-15-2009 at 03:28 PM. Reason: wrap the code [code][/code]

  • #2
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    You can't insert bits of javascript inline like that. That value is literally 'extendform.extenddays.value', not 'whatever the value is'.

    You have to change it later, like

    Code:
    link.href="?ext_days="+extendform.extenddays.value;

  • #3
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    For the beginning: What's the use of those backslashes? \
    Code:
    <td>
    <centre>
    <select id=\"extenddays\"  size=\"1\" name=\"extenddays\">
    ...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #4
    Regular Coder
    Join Date
    Jan 2006
    Posts
    568
    Thanks
    6
    Thanked 84 Times in 84 Posts
    The OP doesn't make it clear, but I gather it's within a PHP echo.

  • #5
    Kor
    Kor is offline
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    shashishinde, post the HTML generated code, not the PHP nor ASP nor whiechever server-side language code. JavaScript interacts only with the HTML elements. We need to see them.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •