Extrafields Radio Button

This is a discussion on Extrafields Radio Button within the Feature Requests forums, part of the Help & Support category; Hi, I'm trying to add Radio Button to Extrafields but nothing appear in viewlisting Look at my process: I add ...


Go Back   68 Classifieds Forums > Help & Support > Feature Requests

 
LinkBack Thread Tools Display Modes
  #1  
Old 12-17-2008, 10:59 AM
hel68c's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 153
Rep Power: 6
Default Extrafields Radio Button

Hi,

I'm trying to add Radio Button to Extrafields but nothing appear in viewlisting

Look at my process:



In Listings.php function modify_listing_fields I duplicate those line and change code
PHP Code:
                        elseif($row['fType']=="R")
                        {
                            
//radio
                            
$optdata.="<tr><td nowrap=\"nowrap\" valign=\"top\" width=\"5%\">".$star ." "$row['fName'].":</td><td align='left' class='formright'>";
                            
$ssql="SELECT optID,fieldID,optValue,optValue_fr,optOrder FROM ".PREFIX."fields_options WHERE fieldID='".$row['fID']."' ORDER BY optValue";
                            
$resultsets=$db->query($ssql);
                            
$selectedOpt=explode("|"$arow['sValue']);
                            while(
$opt=$resultsets->fetch())
                            {
                                if (
in_array($opt['optValue'], $selectedOpt)) 
                                {
                                    
$checked=" CHECKED";
                                }
                                
$optdata.="<input type=\"radio\" name=\"opt".$row['fID']."[]\" value=\"".$opt['optValue']."\"".$checked." />".$opt['optValue']."<br />\n";
                                
$checked="";
                            }
                            
$optdata.="</td></tr>\n";
                        } 
In Listings.php function function extra_listing_fields I duplicate those line and change code
PHP Code:
                            elseif($row['fType']=="R")
                            {
                                
//radio
                                
$optdata.="<tr><td align='left' class='formleft'>".$star ." "$row['fName']." :</td><td align='left' class='formright'>";
                                
$ssql="SELECT optID,fieldID,optValue,optValue_fr,optOrder FROM ".PREFIX."fields_options WHERE fieldID='".$row['fID']."' ORDER BY optValue";
                                
$resultsets=$db->query($ssql);
                                
$selectedOpt=explode("|"$arow['sValue']);
                                while(
$opt=$resultsets->fetch())
                                {
                                    if (
in_array($opt['optValue'], $selectedOpt)) 
                                    {
                                        
$checked=" CHECKED";
                                    }
                                    
$optdata.="<input type=\"radio\" name=\"opt".$row['fID']."[]\" value=\"".$opt['optValue']."\"".$checked." />".$opt['optValue']."<br />\n";
                                    
$checked="";
                                }
                                
$optdata.="</td></tr>\n";
                            } 

Yet the field type checked box has the same properties as the field type radio button.


I can not find my mistake!

__________________
Serge
Hobby Classified
V4.08 Developper
Reply With Quote
  #2  
Old 12-18-2008, 07:36 PM
hel68c's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 153
Rep Power: 6
Default

Any idea where I can look at?
__________________
Serge
Hobby Classified
V4.08 Developper
Reply With Quote
  #3  
Old Yesterday, 12:52 AM
68 Classifieds Staff
 
Join Date: Mar 2006
Location: Belmont, NC
Posts: 4,252
Rep Power: 98
Default

Maybe I am wrong or just to tired. But doesn't radio fields only allow for one selection just like a select list?
__________________
Eric Barnes
68 Classifieds Developer
Please do not send me a private message asking for support. Instead use these open forums or our ticket system.

Customer Area | Issue Tracker | Documentation | 68C Mods | Submit a Ticket | Twitter
Reply With Quote
  #4  
Old Yesterday, 07:55 AM
Moderator
 
Join Date: Jan 2007
Posts: 968
Rep Power: 30
Default

@Eric
No, you're not too tired. That is the point of a radio button group, to only allow one selected option.

-Mike
__________________
Mike-N-Tosh
v3.1.10 Developer IndianaPC.org - A community website
Sandbox v4.0, 4.0.1, 4.0.4, 4.0.8, 4.1b3

Templates for sale | 68 Classifieds Customizations
Web Hosting | Web Design & Development
I am not a 68C employee, just a user and try to help out
Reply With Quote
  #5  
Old Yesterday, 12:00 PM
hel68c's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 153
Rep Power: 6
Default

I would like the option radio button to allow the customer to enter their listings more quickly.

Considering that I have several drop down field. Adding ads becomes heavy.

If as example I offer a choice to a client as:
  • commercial or personnal
  • Sales or Wanted
  • Seller or Buyer

I think it's much faster and efficient a radio button with only 2 or three choices than a drop down list.
__________________
Serge
Hobby Classified
V4.08 Developper
Reply With Quote
  #6  
Old Yesterday, 12:48 PM
Moderator
 
Join Date: Mar 2006
Posts: 3,590
Rep Power: 88
Default

Quote:
Originally Posted by hel68c View Post
I would like the option radio button to allow the customer to enter their listings more quickly.

Considering that I have several drop down field. Adding ads becomes heavy.

If as example I offer a choice to a client as:
  • commercial or personnal
  • Sales or Wanted
  • Seller or Buyer

I think it's much faster and efficient a radio button with only 2 or three choices than a drop down list.
I applaud your willingness to jump in and try and tackle this but you really should take some time to understand the basics of what you are trying to do before you just start hacking up the code.

an html form can consist of different types of input elements. All of these elements have a "name" and in turn a value that gets passed to an underlying script.

A "text field" for example has a name and a single value. a "radio button" has a name and a SINGLE VALUE. A checkbox on the other hand has a name and potentially MANY values.

In php a variable that has many values is an array and as such each value of the array is accessed by a KEY.

The programmatic way you get data from an array is different than the way you get data from a plain old single value variable.

So what you are doing is treating a single value variable (ie radio button) and trying to process it like you would an array and that will account for, at least in part, why you are not getting the results you are looking for.
__________________
Larry.
(Please note: I am not a 68C employee. I am a customer and volunteer who helps with questions where I can and the forums spam free)

Set your site apart from the competition with one of my modules......
Google Map Module | You Tube Module

68 Classifieds Important Links
Customer Area | Issue Tracker | Knowledge Base | User Manuals
Reply With Quote
  #7  
Old Today, 08:40 AM
hel68c's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Canada, Quebec
Posts: 153
Rep Power: 6
Default

Larry thank you for these details. So in summarize I have to treat the radio button as text?

So watch out PHP I'm coming! :-)

I will try to implement your advice.
__________________
Serge
Hobby Classified
V4.08 Developper
Reply With Quote

Bookmarks

« Allopass Gateway | - »
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
extrafields search form seymourjames v4 Questions & Support 1 09-29-2008 09:58 AM
Javascript Validation error extrafields gysgysco v4 Questions & Support 7 09-22-2008 05:14 AM
extrafields seymourjames v4 Questions & Support 4 05-22-2008 08:43 PM
Local Radio Spot louad Site Marketing 5 10-01-2007 06:37 PM
Extrafields to be displayed on the search results and category listings page objelland v3.1 Questions & Support 1 01-13-2007 09:50 AM


All times are GMT -4. The time now is 09:24 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22