This topic is locked
[SOLVED]

 Checkbox:: No is Default in Editor

4/15/2011 1:35:38 PM
PHPRunner General questions
N
nti author

I have worked for several hours in phpr attempting to do what should be very simple.
one field in table = enum('No','Yes')
Visual Editor settings: View As: Checkbox, Edit as: Checkbox, Default = "No"
Required: if viewing list/view/edit page, we view field as No or Yes based on checkbox being checked or not checked.
I do not desire two checkboxes or two radio buttons. I need one checkbox.
Another Option: the checkbox can be present instead of No/Yes. The checkbox can be not checked for NO or checked for YES.
After several hours (20 at least) I can not get it to work.
I am asking for the script that will make it work or the instructions.
kindest regards to all, nti

P
procheck 4/15/2011

I just created one today

  1. Create a field in MySQl tinyint with a length of 1.
  2. PHPRunner will create an input field
  3. Select the input field and right-mouse button/properties
  4. Select Edit As tab
  5. Click on checkbox
  6. Set the default to 0 (off) or 1 (on) depending on your needs
    That's it. In your event, you can do something like:
    if ($userdata["FieldName"] == 1 .....
    Al

N
nti author 4/15/2011

Thanks Al for reply. That corrected my checkbox issue.
The checkbox inline edit and/or edit page does not show as checked until the page is reloaded.
Which is not a good thing for end-users.
Do you know the trick/switch/ or code to fix this issue?
Kindest regards, nti

P
procheck 4/15/2011

Do a search on inline refresh and look for code like below:
setTimeout('window.location.reload(true)',500);
I don't find that it always works so I've resorted to this on some pages

which is not very elegant.
?>

<script>

parent.location.reload();

</script>

<?php
The better way is the first one though.

N
nti author 4/15/2011

The problem was due to my settings in visual editor. I setup Edit As: Checkbox with default = 0 for unchecked for both add page and edit page.
I have discovered thru trial and error that settings in visual editor should be left blank for my specific needs.
I set default 0 at MySql DB field settings for this Checkbox field.
Works very well.
Thank you for help.