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 9 of 9
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts

    input type=radio, accompanying text

    Tutor:
    http://www.htmlcodetutorial.com/form...YPE_RADIO.html

    Is there any uncomplicated way, that allso clicking on actual text "small, medium, ..."
    would make option checked ?
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,676
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    Code:
    <label><input type="radio" name="pizzasize" value="s"> small</label>
    or
    Code:
    <input id="pizza_small" type="radio" name="pizzasize" value="s"> <label for="pizza_small">small</label>
    As a matter of fact, this is far better when it comes to accessibility and is better to styles with CSS (since you have an element more to address). You should always use labels with your form controls.

  • Users who have thanked VIPStephan for this post:

    BubikolRamios (07-29-2010)

  • #3
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Thanks. Was playing around with java script, but this is far better.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #4
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts
    1.Can you allso enlight me, how come that group of input-radio buttons normaly works as semaphore, that is if one is turn on all the rest are turned off.

    2.That pulls up allso question, if having two groups of input-radio buttons on one form , how can one separate/disconnect them.

    3.In case of labels, as in this post thread, that (1) somehow does not work.
    Example: http://agrozoo.net/test.html

    How to fix that ?

    Edit: allso noticed that in IE does not work at all, in FF all radio buttons stays on permanently.
    Last edited by BubikolRamios; 07-30-2010 at 02:49 PM.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #5
    Regular Coder
    Join Date
    Jul 2010
    Location
    St George, UT
    Posts
    138
    Thanks
    6
    Thanked 17 Times in 17 Posts
    Quote Originally Posted by BubikolRamios View Post
    1.Can you allso enlight me, how come that group of input-radio buttons normaly works as semaphore, that is if one is turn on all the rest are turned off.

    2.That pulls up allso question, if having two groups of input-radio buttons on one form , how can one separate/disconnect them.

    3.In case of labels, as in this post thread, that (1) somehow does not work.
    Example: http://agrozoo.net/test.html

    How to fix that ?

    Edit: allso noticed that in IE does not work at all, in FF all radio buttons stays on permanently.
    You just need to add name="group" to each of the boxes that belong in the same group. So your code would look like this:

    Code:
    <div>
    
    
    
                    <div title="Triglav National Park, Slovenia,  avertebrata (Jurij Dobravec, 1995)">
    
                      <input type="radio" id="r1" value="1" name="test">
                      <label for="r1">TNP avertebrata</label>
                      <a href="http://tnp.si/s/bio/nevr/nevret.htm"><img src="../img/g/link.png" alt=""></a>
    
                    </div>
    
                    <div title="Rulls about categorization of herbaceus plants in Slovenia (Uradni list RS, št. 103/2008 z dne 30. 10. 2008 )">
    
                      <input type="radio" id="r2" value="2" name="test">
                      <label for="r2">Herbaceus plants useful allso as food</label>
                      <a href="http://www.uradni-list.si/files/RS_-2008-103-04369-OB~P001-0000.PDF"><img src="../img/g/link.png" alt=""></a>
    
                    </div>
    
                    <div title="Rulls about categorization of herbaceus plants in Slovenia (Uradni list RS, št. 103/2008 z dne 30. 10. 2008 )">
    
                      <input type="radio" id="r3" value="3" name="test">
                      <label for="r3">Herbaceus plants - implementation forbidden</label>
    
                      <a href="http://www.uradni-list.si/files/RS_-2008-103-04369-OB~P001-0000.PDF"><img src="../img/g/link.png" alt=""></a>
    
                    </div>
    
                    <div title="Rulls about categorization of herbaceus plants in Slovenia (Uradni list RS, št. 103/2008 z dne 30. 10. 2008 )">
    
                      <input type="radio" id="r4" value="4" name="test">
                      <label for="r4">Herbaceus plants - without prescription</label>
                      <a href="http://www.uradni-list.si/files/RS_-2008-103-04369-OB~P001-0000.PDF"><img src="../img/g/link.png" alt=""></a>
    
                    </div>
    
    
                    <div title="Rulls about categorization of herbaceus plants in Slovenia (Uradni list RS, št. 103/2008 z dne 30. 10. 2008 )">
    
                      <input type="radio" id="r5" value="5" name="test">
                      <label for="r5">Herbaceus plants - only with prescription</label>
                      <a href="http://www.uradni-list.si/files/RS_-2008-103-04369-OB~P001-0000.PDF"><img src="../img/g/link.png" alt=""></a>
    
                    </div>
    
    
    
                </div>

  • #6
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,963
    Thanks
    120
    Thanked 76 Times in 76 Posts
    Aha. Thanks.
    I have read sopmewhere that id is preffered ower name or name is even obsolute. So since then avoiding name. I guess in this case this is not so.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #7
    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
    Quote Originally Posted by BubikolRamios View Post
    Aha. Thanks.
    I have read sopmewhere that id is preffered ower name or name is even obsolute. So since then avoiding name. I guess in this case this is not so.
    Well, somehow it is true. name is ambiguous. You may have a single element with a certain name, but you may have also several elements with the same name. id is straight: it has to be unique.

    On the other hand, radio groups need, by construction, the same name, in order to act like a group. Forms' elements need also a certain name, to be submitted. id is not enough.

    Till the end, W3C reached a compromise.The name continues to be used along the id, but only for the form's elements.
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

  • #8
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,676
    Thanks
    6
    Thanked 1,008 Times in 981 Posts
    Code:
    <input type="radio" name="group1" />
    <input type="radio" name="group1" />
    <input type="radio" name="group1" />
    
    
    <input type="radio" name="group2" />
    <input type="radio" name="group2" />
    <input type="radio" name="group2" />
    You can see that of these six radio buttons three have a same name each. These are the ones that are related in that if one is selected the other one within that certain group deselected. The two different groups are independet, though.

    Secondly, the name attribute is deprecated except for form controls (input, textarea, and select elements) because server side scripts use the names to process the input data. You can, for example, store the input data in an array it by giving the same name with square brackets to several (related) form controls. That can be useful if you have a form with several similar rows to enter contact data (i. e. phone numbers):

    Code:
    <input type="text" name="phone[]" />
    <input type="text" name="phone[]" />
    <input type="text" name="phone[]" />
    … so a server side script can read the individual values like $_POST['phone'][2] (that’s PHP, for example).

  • #9
    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
    Quote Originally Posted by VIPStephan View Post
    … so a server side script can read the individual values like $_POST['phone'][2] (that’s PHP, for example).
    That is only in PHP. I don't think ASP is able to do that, at least not within the same syntax.
    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
    •