• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

bug in checkbox

Status
Not open for further replies.
joomla 2.5.20
fabrik 3.0.9.x (5151c41ffbc29bdb8ebd8f3043770e5e646c788d.zip just now from github)

1.png = my element setup
2.png = list display with empty cell and not a 'No'
3.png = in database i do not have something like ['0'] or 0 for no but only ['1'] for yes. If i put by hand ['0'] in db then i see No in list view. But if i check and then un-check it will save again without ['0']
 

Attachments

  • 1.png
    1.png
    21.3 KB · Views: 380
  • 2.png
    2.png
    1.3 KB · Views: 354
  • 3.png
    3.png
    2.8 KB · Views: 407
I don't see a problem. It seems to behave exactly as I would expect.

When a new form is displayed, the default value is selected.

If I submit without changing that default, it is recorded correctly to the database, like ["0"].

If I de-select that, so no checkboxes are selected, and submit the form, then an empty string is recorded in the table. Which is the correct behavior.

Am I testing this wrong? Are you describing some other usage scenario?

-- hugh
 
I don't see a problem. It seems to behave exactly as I would expect.

When a new form is displayed, the default value is selected.

If I submit without changing that default, it is recorded correctly to the database, like ["0"].

If I de-select that, so no checkboxes are selected, and submit the form, then an empty string is recorded in the table. Which is the correct behavior.

Am I testing this wrong? Are you describing some other usage scenario?

-- hugh
Your setup is like post#3 or different?

Thanks for looking into it.
 
If I de-select that, so no checkboxes are selected, and submit the form, then an empty string is recorded in the table. Which is the correct behavior.
Is it really?
The "Defaults" tooltipps say "Data to record if no checkbox is ticked"/"Text shown in table view if..."
So I would say the default value should be recorded (analog to dbjoin "please select")

I can see the mismatch in the definition to a standard element "Default".
 
Oh, OK, my bad, I was only thinking about the checkbox default options themselves. As per my comment on github, now I get it. I'll fix that.

-- hugh
 
Hmmmm. Looks like the problem is a little more complex than just tweaking the getEmptyDataValue() method. Still working on it.

-- hugh
 
Why would you use 2 checkboxes for a Yes/No selection?

To compound the issue, as I look at the screen shots you provided ? in the ?Sub Options? list you have the Default set as ?1? (Yes) - and then in the ?Default? area you made the Default ?0? (No). No wonder it doesn?t work.

Use a radio button or Yes/No element instead and set a default. Then there can be no ?empty? field submitted.
 
Yeah, that was kind of my feeling. There's a workaround.

I've pretty much given up on fixing what I was working on, with the getEmptyDataValue() thing ... just turned in to one of those domino effect things. I may take a look at it in 3.2 at some point, but can't flog any more 3.0 horses, even if they ain't quite dead yet.

-- hugh
 
so from what i understand 'Default value' and 'Default label' are not working for elements 'checkbox' in 3.0 and 3.1 version of fabrik.
 
so from what i understand 'Default value' and 'Default label' are not working for elements 'checkbox' in 3.0 and 3.1 version of fabrik.
Yes they are working - so long as you don't include a conflicting default value (by clicking a 'Default' checkbox) in the tab that sets up the checkbox list values.

Look at the first screen snip you provided in your original post.
Do you see how you set the default to be 1 - then set it to be 0?

In the 'Sub options' section you have set 1/Yes to be the default (by clicking the 'Default' checkbox).
Then in the 'Defaults' section you set a 'Default value' to '0' - with the 'Default label' as 'No'.

In the case of multiple checkboxes (or any multiselect elements) there can be multiple defaults (which will get set as 'checked' or 'selected' by default).

So what you should use for any element that requires simple Yes/No logic is either the Yes/No or Radio Button element (which will de-select all others when any one is selected) - You do NOT want to use a checkbox element for what you are trying to do here.

UNLESS, of course - you want to us a SINGLE checkbox to act like a yes/no.
In this case you would set the ONE 'Sub Options' label to a question (e.g. label 'Include?' with a value of '1') and hide the normal element label. Then if the checkbox is checked the value returned will be the value you assigned to the 'value' of that ONE Sub Option. If the checkbox is not checked it wont even be submitted with the POST data - so true/false logic should also work in any validation in this case.
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top