6 of 6
6
Checkboxes
Posted: 22 April 2008 10:29 AM   [ Ignore ]   [ # 91 ]  
Grad Student
Avatar
Rank
Total Posts:  78
Joined  03-17-2006

Hi all - My SQL and PHP coding is limited, so appreciate your help here. Extension working fine in the CP. Now, in my template I want to output a <ul> of all the options, but add a CSS class (“inactive”) to the <li> of unchecked options. Make sense? So the finished code will look something like:

<ul class="ticklist">
<
li>Option</li>
<
li class="inactive">Option</li>
<
li>Option</li>
<
li>Option</li>
</
ul>

Had a stab at a few queries, but no joy. Any help much appreciated.

Profile
 
 
Posted: 22 June 2008 05:57 AM   [ Ignore ]   [ # 92 ]  
Grad Student
Avatar
Rank
Total Posts:  84
Joined  04-25-2008

Is it possible to separate the value of the checkbox from the label? I need the checkboxes say for example “Violence, Drugs, Bad Language” but the values of those checkboxes to be “violence, drugs, bad-language”.

Profile
 
 
Posted: 22 June 2008 06:17 AM   [ Ignore ]   [ # 93 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  596
Joined  12-10-2006

Not sure what version you are using, but in mine…

In Mark’s extension file: ext.checkbox.php
Find:

$r .= $DSP->table_qcell("", $DSP->input_checkbox("field_id_".$row["field_id"]."[]", $item, $select).NBS.$item);

You will notice that it’s not actually a label - just text, which is a bit unfortunate. To change it to a label:

$r .= $DSP->table_qcell("", $DSP->input_checkbox("field_id_".$row["field_id"]."[]", $item, $select).'<label for="'.str_replace(' ','_',$item).'">'.$item.'</label>'

Then you will need some php to convert everything to lowercase. However, I’m using an older version, so it might be completely different in the new version.

Good luck.

Profile
 
 
Posted: 22 June 2008 07:24 AM   [ Ignore ]   [ # 94 ]  
Grad Student
Avatar
Rank
Total Posts:  84
Joined  04-25-2008

Thanks Adam, but in the end I just chose to use weblogs and the Playa extension.

Profile
 
 
Posted: 04 July 2008 10:35 AM   [ Ignore ]   [ # 95 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  128
Joined  04-17-2006
wondermonkey - 14 February 2008 06:46 PM

I’m getting the following all of a sudden (wasn’t doing so before).

MySQL ERROR:

Error Number: 1064

Description
: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND f.group_id=w.field_group AND f.field_type='cbox'' at line 1

Query
: SELECT f.field_id, f.field_name, f.field_pre_populate, f.field_pre_blog_id, f.field_pre_field_id FROM exp_weblog_fields AS f, exp_weblogs AS w WHERE w.weblog_id= AND f.group_id=w.field_group AND f.field_type='cbox'

Disabling the extension fixes it.

I am having this exact issue. Started happening today without any modifications or upgrades at all. Once I noticed it, I upgraded the whole system to the latest build (which needed to be done anyway). When that didn’t fix it, I found some folks experiencing the same problem with Multi Drop-down List. So I disabled Checkboxes and that solved it. It only occurs when I am logged in as Super Admin. I did download and re-install the extension from the first post of the thread, to no avail.

We rely on the Checkboxes plugin, so I’d love a fix for this. Especially since Mark has not responded to wondermonkey‘s original message from four months ago that points out this problem.

 Signature 

http://davidrussell.org | http://twitter.com/davidrussell

Profile
 
 
Posted: 08 July 2008 11:36 AM   [ Ignore ]   [ # 96 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  128
Joined  04-17-2006

After spending many hours staring at ext.checkbox.php, I haven’t gotten any farther than when this crazy issue began last week. I’m still mesmerized by the strangeness of it all. I’m considering all kinds of wild ideas, like my host changing my database configuration or version. But I can’t fix this without help from someone who can perceive the issue.

Here’s what I do know. The issue must be somewhere inside the ‘modify_template’ function. I narrowed it down to one of the lines that queries the db. It looks as though ‘$row[“weblog_id”]’ is not bringing the weblog_id into the function as it should. Because I am using checkboxes for only one weblog, I hard-coded the ID. That appears to have temporarily treated the issue, but that is obviously no perfect fix and I can’t know whether or not that has an adverse affect.

If anyone can help, I would greatly appreciate it.

function modify_template( $tagdata, $row )
    
{
        
global $DB, $TMPL, $EXT;
        
        if(
$EXT->last_call !== false)
        
{
            $tagdata
= $EXT->last_call;
        
}
        
        $query
= $DB->query("SELECT f.field_id, f.field_name, f.field_pre_populate, f.field_pre_blog_id, f.field_pre_field_id FROM exp_weblog_fields AS f, exp_weblogs AS w WHERE w.weblog_id=".$row["weblog_id"]." AND f.group_id=w.field_group AND f.field_type='cbox'");
        foreach(
$query->result as $field)
        
{
            
if(isset($row["field_id_".$field["field_id"]]))
            
{
                preg_match_all
("/".LD.$field["field_name"]."(.*?)".RD."/", $tagdata, $matches);
                foreach(
$matches[0] as $key=>$match)
                
{
                    $items
= (preg_match("/[\r\n]+/", $row["field_id_".$field["field_id"]])) ? preg_split("/[\r\n]+/", $row["field_id_".$field["field_id"]]) : array($row["field_id_".$field["field_id"]]);
                    if(
$field["field_pre_populate"] == "y" && !preg_match("/[a-zA-Z]/", $row["field_id_".$field["field_id"]]) && trim($row["field_id_".$field["field_id"]]) != "" && count($items) > 0)
                    
{
                        $query
= $DB->query("SELECT entry_id, field_id_".$field["field_pre_field_id"]." AS display FROM exp_weblog_data WHERE weblog_id=".$field["field_pre_blog_id"]." AND entry_id IN(".implode(",", $items).")");
                        foreach(
$query->result as $result)
                        
{
                            $items[array_search
($result["entry_id"], $items)] = $result["display"];
                        
}
                    }
                    
if(isset($this->settings['seperator']) && $this->settings['seperator'] != "")
                    
{
                        $seperator
= $this->settings['seperator'];
                    
}
                    
else if(preg_match("/separator\s*=\s*['\"](.*?)[\"']/", $matches[1][$key], $seperator))
                    
{
                        $seperator
= $seperator[1];
                        switch(
$seperator)
                        
{
                            
case '\r':
                                
$seperator = "\r";
                                break;
                            case
'\n':
                                
$seperator = "\n";
                                break;
                            default:
                        
}
                    }
                    
else
                    
{
                        $seperator
= ", ";
                    
}
                
                    $template_data
= implode($seperator, $items);
                    
$tagdata = str_replace($match, $template_data, $tagdata);
                
}
            }
        }
        
        
return $tagdata;
    
}

 Signature 

http://davidrussell.org | http://twitter.com/davidrussell

Profile
 
 
Posted: 28 August 2008 12:12 PM   [ Ignore ]   [ # 97 ]  
Summer Student
Total Posts:  7
Joined  07-14-2008

Mark,

I am getting the following errors when I choose to populate the values from another checkbox field:

Notice: Undefined variable: key in /path/extensions/ext.checkbox.php on line 275
Notice: Undefined variable: key in /path/extensions/ext.checkbox.php on line 277
Notice: Undefined variable: key in /path/extensions/ext.checkbox.php on line 280

The checkbox list I am trying to populate from contains 26 values, and the existing checkbox field works fine.

Any ideas? Thanks - GREAT EXTENSION!!
rccjax

Profile
 
 
Posted: 28 August 2008 12:23 PM   [ Ignore ]   [ # 98 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  128
Joined  04-17-2006

rccjax I wouldn’t expect much support on issues related to this extension. It appears the extension author has abandoned this thread long ago. Tough thing to see and something I’ve never experienced before in the EE community. Still, good luck to all of us in this thread who have unresolved issues.

 Signature 

http://davidrussell.org | http://twitter.com/davidrussell

Profile
 
 
Posted: 29 August 2008 11:20 AM   [ Ignore ]   [ # 99 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1726
Joined  03-26-2006

Did your host change to mySQL 5? I had that same sort of error on one of my sites “all of a sudden” and I had to slightly modify the SQL query with some parentheses to bring the query up to mySQL 5 standards. It might even be as simple as changing

AND f.group_id=w.field_group AND f.field_type='cbox'


to

AND (f.group_id=w.field_group) AND (f.field_type='cbox')

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 02 September 2008 06:33 AM   [ Ignore ]   [ # 100 ]  
Summer Student
Total Posts:  7
Joined  07-14-2008

No luck. I’ll dig in a little deeper this week. Initial research may indicate a scope issue with $key.

Profile
 
 
   
6 of 6
6
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 64905 Total Logged-in Users: 54
Total Topics: 81838 Total Anonymous Users: 31
Total Replies: 440011 Total Guests: 266
Total Posts: 521849    
Members ( View Memberlist )