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 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Newbie question about Input Radio & Checkbox

    Hi

    I have this code :

    <input type="radio" value="1" name="PH" onFocus="javascript:document.getElementById('cp1').value='18,00';"><input type="text" size="6" id="cp1" name="cp1" value="--" readonly><br />
    <input type="radio" value="2" name="PH" onFocus="javascript:document.getElementById('cp2').value='36,00';"><input type="text" size="6" id="cp2" name="cp2" value="--" readonly><br />
    <input type="radio" value="3" name="PH" onFocus="javascript:document.getElementById('cp3').value='48,00';"><input type="text" size="6" id="cp3" name="cp3" value="--" readonly><br />
    <input type="radio" value="4" name="PH" onFocus="javascript:document.getElementById('cp4').value='72,00';"><input type="text" size="6" id="cp4" name="cp4" value="--" readonly><br />
    <input type="radio" value="5" name="PH" onFocus="javascript:document.getElementById('cp5').value='45,60';"><input type="text" size="6" id="cp5" name="cp5" value="--" readonly><br />
    <hr />
    <input type="checkbox" value="1" name="SA" onClick="javascript:document.getElementById('servizio1').value='1800';" > servizio 1 <input type="text" size="6" id="servizio1" name="servizio1" value="--" readonly><br />
    <input type="checkbox" value="2" name="SA" onClick="javascript:document.getElementById('servizio2').value='3360';" > servizio 2 <input type="text" size="6" id="servizio2" name="servizio2" value="--" readonly><br />
    <input type="checkbox" value="3" name="SA" onClick="javascript:document.getElementById('servizio3').value='6000';" > servizio 3 <input type="text" size="6" id="servizio3" name="servizio3" value="--" readonly><br />
    <input type="checkbox" value="4" name="SA" onClick="javascript:document.getElementById('servizio4').value='7200';" > servizio 4 <input type="text" size="6" id="servizio4" name="servizio4" value="--" readonly><br />


    But is not correct

    When Radio input is selected user must view number on respective cp, but when focus change I must remove old number and put new..

    For the Checkbox input user can selected more but when "deselected" I must remove number..

    Help

    thks
    http://www.webstyler.it

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    For the radio buttons, do you really want it onfocus and not onclick?
    What is really the purpose of this? Why not just have the textbox values specified by default and when the form is submitted, just retrieve the corresponding textbox value based on the checked radio button and checkbox and ignore the others.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Feb 2004
    Posts
    24
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv
    For the radio buttons, do you really want it onfocus and not onclick?
    What is really the purpose of this? Why not just have the textbox values specified by default and when the form is submitted, just retrieve the corresponding textbox value based on the checked radio button and checkbox and ignore the others.
    Hi,
    I need to realtime check for service and addon price.
    http://www.webstyler.it

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,068
    Thanks
    0
    Thanked 256 Times in 252 Posts
    How is that related to my suggestion?

    I was suggesting this:
    Code:
    <input type="radio" value="1" name="PH"><input type="text" size="6" id="cp1" name="cp1" value="18,00" readonly><br />
    Then when the page is submitted, retrieve the corresponding textbox based on the selected radio button. If you're using ASP, you would do this:
    Code:
    <%
    dim ph, cp
    ph = request.form("PH")
    cp = request.form("cp" & ph)
    %>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________


  •  

    Posting Permissions

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