4images Forum & Community
Welcome, Guest. Please login or register.
Did you miss your activation email?
July 29, 2016, 09:46:45 AM

Login with username, password and session length
Search:     Advanced search
4images is now on facebook. Click here and become a fan!
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 blues
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Print
Author Topic: radio button blues  (Read 8135 times)
bigwillhere
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 0
-Receive: 0


View Profile
« on: February 25, 2008, 09:42:31 PM »

Hi everyone.

I love 4images. I just started to do some custom work. I read everything and I mean everything I could on the forum about radio buttons. I read the explanation in db_field_definitions.php at least 10 times. I must not understand or don't have the expertise to understand what I read because I can't get it to work. I prefer radio button over a pull down menu for gender selection (I say this because someone already had a mod for pull down, but radio is better, so please don't give me a link to that mod since it is pull down).

I hope by showing you the steps I took someone can tell me what I did wrong.

1. In register_form I added:

   <tr>
            <td class="row1"><b>Gender</b></td>
            <td class="row1">
              <input type="radio" name="user_gender" value="Male"{user_gender} />
              Male&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_gender" value="Female"{user_gender} />
              Female</td>
          </tr>


   2. In db_field_definitions.php I added:

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


   3. In mysql database I added new fields in 4images_users called user_gender


   4. In member_profile I added the following

   <tr>
             <td class="row2"><strong>Gender</strong></td>
             <td class="row2">{user_gender}</td>
           </tr>


   5. To edit I added in member_editprofile the following (same info  as register_form)

   <tr>
            <td class="row1"><b>Gender</b></td>
            <td class="row1">
              <input type="radio" name="user_gender" value="Male"{user_gender} />
              Male&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_gender" value="Female"{user_gender} />
              Female</td>
          </tr>


When I test, it puts a number 1 in for male. When I edit and change it to female it is puts nothing (blank). Any help in simple terms would be appreciated (sorry I'm new to this).

Thanks
« Last Edit: February 25, 2008, 09:56:57 PM by bigwillhere » Logged
thunderstrike
4images Guru
*******
Offline Offline

Posts: 2327

Thank You
-Given: 0
-Receive: 10


View Profile
« Reply #1 on: February 26, 2008, 02:06:32 AM »

Register form:

1
2
3
4
5
6
7
8
<tr>
            <td class="row1"><b>{lang_user_gender}</b></td>
            <td class="row1">
              <input type="radio" name="user_gender" value="0"{user_gender} />
              Male&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_gender" value="1"{user_gender} />
              Female</td>
          </tr>

edit profile:

1
2
3
4
5
6
7
8
<tr>
            <td class="row1"><b>{lang_user_gender}</b></td>
            <td class="row1">
              <input type="radio" name="user_gender" value="1"{user_gender} />
              Male&nbsp;&nbsp;&nbsp;
              <input type="radio" name="user_gender" value="0"{user_gender} />
              Female</td>
          </tr>

Note:

1 - Member page is get numeric value. No string in input value (same for additional image field). Is why is no work.
2 - You say: $lang['user_gender'] in db_field_definitions file so in member template - use: {lang_user_gender} .

Wink
Logged

8 steps need when ask question -

- PHP version (ACP - > phpinfo())
- mySQL version (ACP - > phpinfo())
- 4images version
- Post screenshot / URL
- Post code in BB Code (no need full file for code) or post attach file
- It doesn't work. What is say - what is do for no work
- Install MOD ? If so - please say (troubleshooting)
- Read FAQ ? Install Bug fixes ?
bigwillhere
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #2 on: February 26, 2008, 05:35:03 AM »

Thank you so much Very Happy
Logged
karlo16
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #3 on: September 04, 2008, 07:18:17 PM »

I have exactly the same problem  Sad.
All I get is 1 instead of YES or nothing instead of NO. I have checked the code 100 times but I don´t see what is wrong.

In the database I added a field named "user_comm" to the "4images_users" table , type tinyint.


In member_profile.html:

1
2
3
4
<tr>
   <td class="row2"><b>{lang_user_comm}</b></td>
   <td class="row2">{user_comm}</td>
</tr>


In member_editprofile.html:

1
2
3
4
5
6
7
8
9
10

<tr>
    <td class="row2"><b>{lang_user_comm}</b></td>
    <td class="row2">
    <input type="radio" name="user_comm" value="1"{user_comm_yes} />
        {lang_yes}&nbsp;&nbsp;&nbsp;
     <input type="radio" name="user_comm" value="0"{user_comm_no} />
        {lang_no}
     </td>
</tr>


In db_field_definitions.php:

1
$additional_user_fields['user_comm'] = array($lang['user_comm'], "radio", 1);


Any help would be greatly appreciated.
Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 561

mmm PHP...


View Profile WWW
« Reply #4 on: September 05, 2008, 12:32:23 AM »

All I get is 1 instead of YES or nothing instead of NO.

Where do you get it? On the page or in the database? if in the database then its normal, because "tinyint" can only hold simple numbers.
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
karlo16
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #5 on: September 06, 2008, 12:05:51 PM »

Hi,
I don´t mean the entries in the database, I mean what I get on member_profile.html, where I have this code:

1
2
3
4
<tr>
   <td class="row2"><b>{lang_user_comm}</b></td>
   <td class="row2">{user_comm}</td>
</tr>

My understanding was that {user_comm} should result in a YES or a NO, depending on what the user selected on member_editprofile.html. Instead I get a 1 or a blank on that page.



Logged
V@no
If you don't tell me what to do, I won't tell you where you should go :)
Administrator
4images Guru
*****
Offline Offline

Posts: 17849

Thank You
-Given: 47
-Receive: 561

mmm PHP...


View Profile WWW
« Reply #6 on: September 06, 2008, 06:57:51 PM »

No, it doesn't work like that.
use this instead:
1
2
3
4
<tr>
   <td class="row2"><b>{lang_user_comm}</b></td>
   <td class="row2">{if user_comm}{lang_yes}{endif user_comm}{ifno user_comm}{lang_no}{endifno user_comm}</td>
</tr>
Logged

Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)
karlo16
Newbie
*
Offline Offline

Posts: 20

Thank You
-Given: 0
-Receive: 0


View Profile
« Reply #7 on: September 06, 2008, 11:09:30 PM »

Wow - thank you so much!  Very Happy
It almost works - I only had to replace {lang_yes} and {lang_no} with YES and NO. No idea why - but anyway it´s working now.

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.318 seconds with 19 queries.