4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
September 26, 2016, 07:21:42 PM

Login with username, password and session length
Search:     Advanced search
Togle to toolbar
Translate this page with =>
Translate this page >
* Home Help Search Login Register
 
+  4images Forum & Community
|-+  4images Issues / Ausgaben
| |-+  Discussion & Troubleshooting (Moderators: Acidgod, ivan, Rembrandt)
| | |-+  radio button
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: radio button  (Read 4431 times)
steveeyes
Full Member
***
Offline Offline

Posts: 177

Thank You
-Given: 0
-Receive: 0


View Profile
« 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
Logged

ivan
Moderator
4images Guru
*****
Offline Offline

Posts: 2279

Thank You
-Given: 4
-Receive: 30


View Profile WWW
« Reply #1 on: February 26, 2007, 08:28:42 PM »

hi steve,
image_fields is for image
user_fields for user

use this
1
$additional_user_fields['user_gender']= array($lang['image_gender'], "radio", 1);

greets ivan
Logged

greetings / grüsse
ivan

Facebook Fan Page | Follow Twitter

Blog: Reisen Blog
Bilder Gallery: Bilder Gallery
steveeyes
Full Member
***
Offline Offline

Posts: 177

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 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.

Logged

ivan
Moderator
4images Guru
*****
Offline Offline

Posts: 2279

Thank You
-Given: 4
-Receive: 30


View Profile WWW
« Reply #3 on: February 26, 2007, 10:15:27 PM »

hi steve,
use this gender mod, is very nice
http://www.4homepages.de/forum/index.php?topic=7385.0;topicseen


greets ivan
Logged

greetings / grüsse
ivan

Facebook Fan Page | Follow Twitter

Blog: Reisen Blog
Bilder Gallery: Bilder Gallery
steveeyes
Full Member
***
Offline Offline

Posts: 177

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #4 on: February 27, 2007, 01:45:16 AM »

Ivan..........I looked at that already.........it is drop down..........not radio..........


Any Help Please????????
Logged

steveeyes
Full Member
***
Offline Offline

Posts: 177

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #5 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

Logged

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.284 seconds with 20 queries.
Post your comments here