4images Forum & Community

4images Issues / Ausgaben => Discussion & Troubleshooting => Topic started by: steveeyes on February 26, 2007, 07:20:06 PM

Title: radio button
Post by: steveeyes on February 26, 2007, 07:20:06 PM
Hi

I'm trying to make radio buttons for male and female selection. I read the information in db_field_definitions.php, but it didn't provide enough information for me to understand how to create the buttons.

Next I looked at the example in the default template for making a user invisible or visible, but this didn't help me to adapt my radio button to an image field.

Here  is what I did:

1. Updated main.php with the following:

$lang['image_gender'] = "Your Gender:";
$lang['image_male'] = "Male";
$lang['image_female'] = "Female";


2. Added the image_gender to sql with tinyint(1) as the integer


3. Added  to db_field_definitions.php the following:

$additional_image_fields['image_gender'] = array($lang['image_gender'], "radio", 1);


3. Added the following to member_uploadform.html and member_editimage.html

 <tr>
            <td class="row2"><b>{lang_image_gender}</b></td>
            <td class="row2">

<input type="radio" name="image_gender" value="1"{image_gender_male}/>{lang_image_male}

<input type="radio" name="image_gender" value="0" {image_gender_female}/>{lang_image_female}
             
            </td>
          </tr>


When I went to test it, it did not work. All I saw was the words "Your Gender" but no male or female was provided (it was blank).

I didn't quite understand what the value=1 or value=0 meant. I also tried value=male and value=female, but the results where the same -- nothing shown.

I would appreciate it if anyone could tell me how to make this work?

I know others have  asked how to do radio buttons, but the answer was always to look at db_field_definitions.php. Again, I did read and I can make text fields and textarea fields with no problems,  but it did not provide me with enough info for me to understand how to do radio buttons.

Thanks in advance
Steve
Title: Re: radio button
Post by: steveeyes on February 26, 2007, 09:32:38 PM
Hey Ivan

Thanks for getting back to me but now I am confused. I tried your suggestion, but it did not work. I know that  their are two fields: image and user. Which one you use I thought depended on where you wanted to put the field.

In this case, I'm putting it in the member_uploadforum.html and member_editimage.html. Both relate to images, not user. If  I made changes to member_profile.html and member_editprofile.html, that is when I would use the user field.


 Let me give you can example of an input field I created for  religion  under images that works (note: all my text fields work, it is the radio one I can't figure out).


In db_field_field_definitions.db I put:


$additional_image_fields['image_religion'] = array($lang['image_religion'], "text", 0);



In member_uploadform.html and member_editimage.html  I put:


<tr>
            <td class="row2"><b>{lang_image_religion} (optional) </b></td>
            <td class="row2">
              <input name="image_religion" type="text" class="input" value="{image_religion}"  size="30" maxlength="30" />
            </td>
          </tr>



In main.php I put:

$lang['image_religion'] = "Religion:";



In the sql database I added in  the 4images_images and 4images_images_temp tables this:

Field = image_religion
Type = VARCHAR
Lenght = 255


All works fine (see picture below).



Unlike text fields, radio fields seem to require more info when added to the templates. But it is confusing and when I look at the examples of radio fields already created it doesn't help.

By the way Ivan, I did try your suggestion, but it did not work.

Hopefully I clarified it better and maybe someone can tell me what I'm doing wrong or what I'm not understanding.

(http://www.asian-wife.net/pix.jpg)
Title: Re: radio button
Post by: steveeyes on February 27, 2007, 01:45:16 AM
Ivan..........I looked at that already.........it is drop down..........not radio..........


Any Help Please????????
Title: Re: radio button
Post by: steveeyes on February 28, 2007, 01:36:13 AM
Sorry to ask again.....any help please...........Ivan suggestion was a good one, but not what I need. I need radio buttons for male or female when the member adds his photo. See image above and my post above for further explanation.

Any help would be appreciated.........

thanks
steve