Hi,
I feel this is a silly question but i will ask anyway.
I am populating a form from a database resource and one of the values is a 1 (Yes) or a 0(No). I am taking this value and if it is 1 I want to set it's associated form field (let's call it field1) to 1 - this is all fine, I can see it working in the log's.
However, the field control is a checkbox and I am really struggling to set it to ticked if the associated resource is 1...can anyone advise?
I have gone through the list of methods for controls.chk_field1.... and fields.field1...however I simply can't see anything?
Thanks, hopefully I am not trying to "misuse" the checkbox or ignore best practice etc.
How to set checkbox to ticked?
Moderators: Jon, Steve, Ian, Dave
-
- Ebase User
- Posts: 95
- Joined: Wed Feb 27, 2013 5:16 pm
-
- Moderator
- Posts: 1342
- Joined: Wed Sep 12, 2007 12:49 pm
If it's a checkbox, the field type must be boolean and you need to set the field value to true to show the checkbox as checked. The system will also let you use display type of checkbox with field types other than boolean, but these should only be used for lists. You won't be able to display the checkbox in this case unless you have a list. Bottom line: if it's not a list field, the field type must be boolean.
If you have a boolean field called BOOL1, any of these should work with Javascript:
If your using FPL, the equivalent would be:
You should also be able to map a boolean Ebase form field to a database column of type boolean/bit/short/int and read the database value and display it automatically as a checkbox.
Regards
Jon
If you have a boolean field called BOOL1, any of these should work with Javascript:
Code: Select all
fields.BOOL1.value = true;
fields.BOOL1.value = 1;
fields.BOOL1.value = "Y";
Code: Select all
BOOL1 = true;
BOOL1 = 1;
BOOL1 = 'Y';
Regards
Jon
0 x
-
- Ebase User
- Posts: 95
- Joined: Wed Feb 27, 2013 5:16 pm
Who is online
Users browsing this forum: No registered users and 25 guests