Checkbox |
Post Reply |
Author | |
william3
Newbie Joined: Dec 08 2015 Location: Germany Status: Offline Points: 22 |
Post Options
Thanks(0)
Posted: Dec 18 2015 at 6:51am |
Hello,
today I have a new question. I am reading a set of data from a file and going to display these values in the data entry fields of my form. One of these is a checkbox and I don't find the way to check/uncheck the box according to the data of my file. How can I do this? Is there any method like it is for the value field of a textual entry field when setting "<?php echo '$variable'; ?> into the value field? Tks, William3
|
|
Dmit OE
Admin Group Joined: May 31 2012 Status: Offline Points: 5283 |
Post Options
Thanks(0)
|
Hi,
You can't directly put PHP into the field, but you can use jQuery to apply values generated by PHP. For example, put into Properties->Custom Classes "php-checkbox1" for a checkbox (without ""), "php-text1" for a text field, then add a Code Block (Source) type Javasript position Header with something like: $(function() { // on page structure loaded var phpYesNo = <?php echo $variable ? 'true' : 'false'; ?>; // transform to true or false var phpText = <?php echo $variableText; ?>; // text value - write as is $('.php-checkbox1 input').prop('checked', phpYesNo); $('.php-text1 input').val(phpText); }); |
|
william3
Newbie Joined: Dec 08 2015 Location: Germany Status: Offline Points: 22 |
Post Options
Thanks(0)
|
Again,
thank you for your help, perfect. The longer I am using oE the more I like it. It seems to finally have a solution for every scenario William3 |
|
Dmit OE
Admin Group Joined: May 31 2012 Status: Offline Points: 5283 |
Post Options
Thanks(0)
|
It allows a lot of manual intervention in case of need, so for a professional nearly all is possible.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |