This topic is locked

Radio button default

11/9/2005 1:50:16 PM
PHPRunner General questions
author

Hello,
Hello, there is a means to tick an option by default in radio button or check boxes?
thanks

admin 11/10/2005

Deborah,
yes, you can do this modifying generated inlude\..._functions.phpfile.

Open it with a text editor and locate GetDefaultValuefunction.
Then modify it this way, please see my changes in bold:

if($field=="RadioField") return "Value1";

if($field=="CheckboxField") return 1;

500380 11/10/2005

Hello,
Thanks you for your response. I'm working on radio buttons and I think I found a bug: When I use 'lookup table', my display field take the value of my link field. By modifing the following lines in source/functions.php l580, it's run:

my changes are in bold

if($data[0]==$value)

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

else

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

}

Bye

admin 11/11/2005

Deborah,
thank you for finding this bug. We'll correct it in the next PHPRunner update.
Table based Radio buttons are rarely used so we missed the error.