This topic is locked

Radio button choices are images urls

9/7/2005 12:35:35 PM
PHPRunner General questions
0
0ad author

hi
just wondering if anyone could tell me a generated or manual way to change the way a radio button choices is displayed in edit mode.
at the moment i have 2 radio buttons choices: and

Sergey Kornilov admin 9/8/2005

Oad,
to set image instead of radio button inscription you need to do the following.

  • Enter list of values for your radio button filed on the Formattingtab in PHPRunner.
  • Build the pages and open ...\include\..._functions.php file by any text editor.
  • Find BuildRadioControlfunction and replace this line (where 1,2,3 - are entered values):
    if("YourField"==$field) { $arr = array("1", "2", "3");}


with this one:

if("YourField"==$field)

    {

$arr = array("1", "2", "3");

$arrdisplay = array('<img src="include/images/smiley.gif">', '2', '3');

    }


  • Then replace this code snippet:

    foreach($arr as $opt)

      {

      if($opt==$value)

    $ret.='<input type="Radio" name="radio'.$ifield.'" onclick="java script: value'.$ifield.".value='".db_addslashes($opt).'\'; return true;" checked>'.htmlspecialchars($opt)."
    ";

      else

    $ret.='<input type="Radio" name="radio'.$ifield.'" onclick="java script: value'.$ifield.".value='".db_addslashes($opt).'\'; return true;">'.htmlspecialchars($opt)."
    ";

      }




    with this one:

    foreach($arr as $key=>$opt)

      {

      if($opt==$value)

    $ret.='<input type="Radio" name="radio'.$ifield.'" onclick="java script: value'.$ifield.".value='".db_addslashes($opt).'\'; return true;" checked>'.$arrdisplay[$key]."
    ";

      else

    $ret.='<input type="Radio" name="radio'.$ifield.'" onclick="java script: value'.$ifield.".value='".db_addslashes($opt).'\'; return true;">'.$arrdisplay[$key]."
    ";

      }



0
0ad author 9/9/2005

Cheers!
got:
Undefined variable: arrdisplay
error, i think it almost worked though =))
regards
0ad

Sergey Kornilov admin 9/9/2005

Oad,
if you have other radio fields then also modify BuildRadioControl function this way:

Replace

if("YourOtherField"==$field) { $arr = array("1", "2", "3");}

with

if("YourOtherField"==$field) { $arr = array("1", "2", "3"); $arrdisplay=$arr;}
0
0ad author 9/9/2005

First Class Support Sergey!!!!
That worked perfectly, thank you so much!
Great App, great support
Nuff Respect
0ad