This topic is locked
[SOLVED]

 Horizontal Checkboxes

7/12/2013 6:25:03 PM
PHPRunner General questions
S
stiven author

Hello,
Does anyone know if there is a way to limit the amount of checkboxes per line, I have a field set up as lookup wizard, then checkbox list, and horizontal layout. The problem is that there are about 20 options. Is there any way to have them show let's say 5 per line that way I won't have to be scrolling horizontally to be able to see all 20 options. Maybe editing the code manually on the checkbox settings? but where would I find it?
Thanks for your help

Sergey Kornilov admin 7/13/2013

If you decide to modify this setting manually check C:\Program Files (x86)\PHPRunner6.2\source\classes\controls\LookupField.php file.

Here is the code snippet you looking for:



case LCT_CBLIST:

echo '<div>';

$spacer = '<br/>';

if($this->horizontalLookup)

$spacer = ' ';

$i = 0;

foreach($arr as $opt)

{

echo '<input id="'.$this->cfield.'_'.$i.'" class="runner-checkbox" type="checkbox" '.$this->alt.' name="'.$this->cfield.$this->postfix.'" value="'

.htmlspecialchars($opt).'"';

$res = array_search((string)$opt, $avalue);

if(!($res === NULL || $res === FALSE))

echo ' checked="checked" ';

echo '/>';

echo ' <b class="runner-checkbox-label" id="data_'.$this->cfield.'_'.$i.'">'.htmlspecialchars($opt).'</b>'.$spacer;

$i++;

}

echo '</div>';

break;
S
stiven author 7/15/2013

Thank you so much, this is exactly what i was looking for

S
stiven author 7/16/2013

I tried to modified the code, and I noticed it only works on checkbox list when the list is created manually but if it is pulling the records from another table it doesn't work, could someone point me what I'm doing wrong, if there is something I can do to fix it?
thanks here is the code



case LCT_CBLIST:

echo '<div style="display:inline">';

$spacer = '<br/>';

if($this->horizontalLookup)

$spacer = '&nbsp;&nbsp;';

$i = 0;

foreach($arr as $opt)

{

if($i == 9 || $i == 18){

$spacer = '<br/>';

}else{

$spacer = '&nbsp;&nbsp;';

}

echo '<input id="'.$this->cfield.'_'.$i.'" class="runner-checkbox" type="checkbox" '.$this->alt.' name="'.$this->cfield.$this->postfix.'" value="'.htmlspecialchars($opt).'"';

$res = array_search((string)$opt, $avalue);

if(!($res === NULL || $res === FALSE))

echo ' checked="checked" ';

echo '/>';

echo '&nbsp;<b class="runner-checkbox-label" id="data_'.$this->cfield.'_'.$i.'">'.htmlspecialchars($opt).'</b>'.$spacer;

$i++;

}

echo '</div>';

break;




If you decide to modify this setting manually check C:\Program Files (x86)\PHPRunner6.2\source\classes\controls\LookupField.php file.

Here is the code snippet you looking for:



case LCT_CBLIST:

echo '<div>';

$spacer = '<br/>';

if($this->horizontalLookup)

$spacer = ' ';

$i = 0;

foreach($arr as $opt)

{

echo '<input id="'.$this->cfield.'_'.$i.'" class="runner-checkbox" type="checkbox" '.$this->alt.' name="'.$this->cfield.$this->postfix.'" value="'

.htmlspecialchars($opt).'"';

$res = array_search((string)$opt, $avalue);

if(!($res === NULL || $res === FALSE))

echo ' checked="checked" ';

echo '/>';

echo ' <b class="runner-checkbox-label" id="data_'.$this->cfield.'_'.$i.'">'.htmlspecialchars($opt).'</b>'.$spacer;

$i++;

}

echo '</div>';

break;


W
wildwally 7/16/2013

you might try forcing a width to the cell and make the items word wrap. Just a thought, not tested.

S
stiven author 7/16/2013



you might try forcing a width to the cell and make the items word wrap. Just a thought, not tested.


this didn't work :/