This topic is locked

View Field as Checkbox?

8/27/2005 3:12:50 PM
PHPRunner General questions
author

Hello,
is there a possibility to view fields within the list as a checkbox? Edit as checkbox can be formatted as a checkobx , but it would be much easer to unterstand the sense of the data, if user could see a checkbox instead of "0" or "1" in the list-view.
With best reguards
punchbyte

admin 8/29/2005

Hi,
to view checkboxes on the List/View pages do the following:

  • open \include\..._functions.php with any text editor.
  • find this code snippet:
    function GetData($rs,$data,$field, $format)

    {

    global $fieldlist,$strKeyField, $strKeyField2,$strKeyField3,$thumbnail_fields,$thumbnail_prefixes,$thumbnail_maxsize;

    $ret="";

    // long binary data?

    if(IsBinaryField($rs,$field))

    {

    Â $ret="LONG BINARY DATA - CANNOT BE DISPLAYED";

    } else

    Â $ret = $data[$field];

    if($ret===false)

    Â return "";


  • and insert right after it the following one:
    if(strtoupper($field)==strtoupper("FieldName"))

    {

    Â if($ret)

    Â   return "<input type=Checkbox checked disabled>";

    Â else

    Â   return "<input type=Checkbox disabled>";

    }


where FieldName is your checkbox field name.

501235 8/29/2005

I had the same concern, and when I added your snippet - I got the words
<checkbox checked>
or
<checkbox checked disabled>
instead of the checkbox graphic. What am I doing wrong?

admin 8/30/2005

Sorry,
you should set View as type - HTML for this field on Formattingtab in PHPRunner, then build the pages and then make modifications.