BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >

openElement

> Websites Created with OpenElement
  New Posts New Posts RSS Feed - Checkbox
  FAQ FAQ  Forum Search   Register Register  Login Login

Checkbox

 Post Reply Post Reply
Author
Message
william3 View Drop Down
Newbie
Newbie
Avatar

Joined: Dec 08 2015
Location: Germany
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote william3 Quote  Post ReplyReply Direct Link To This Post Topic: Checkbox
    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
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: Dec 18 2015 at 12:29pm
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);

});
Back to Top
william3 View Drop Down
Newbie
Newbie
Avatar

Joined: Dec 08 2015
Location: Germany
Status: Offline
Points: 22
Post Options Post Options   Thanks (0) Thanks(0)   Quote william3 Quote  Post ReplyReply Direct Link To This Post Posted: Dec 21 2015 at 7:10am
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
Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: Dec 21 2015 at 9:35am
It allows a lot of manual intervention in case of need, so for a professional nearly all is possible.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.