Readonly in databasejoin checkboxes

porlhews

Member
Hi,

I've got a databasejoin element which renders as checkboxes. It works fine.

I'd like to keep some of the options visible, but make them readonly - so that the user can see them, but not select them.

In the Eval Options under the advanced tab on the databasejoin element, the description seems to suggest that $opt->disable = true would work in a drop down context.

Any advice on how to make the checkboxes readonly?

Thanks in advance,

Paul Hughes
 
Hi troester,

I tried it and it works fine for a multi-select dropdown render.

I need it to work for a multi select checkbox render - when I tried it, it didn’t have any effect.

Any ideas?

Thanks for your help,

paul
 
Nope, won't work for checkboxes because checkboxes can't be set to readonly in HTML. You can set them to disabled, but then the value of that checkbox won't get submitted with the form.

If you want, you could override the layout, by copying ...

plugins/fabrik_element/databasejoin/layouts/fabrik-element-databasejoin-form-checkbox.php

... to ...

templates/<your site template>/html/layouts/com_fabrik

... and try modifying the code to implement the second solution in this ...

https://stackoverflow.com/questions/155291/can-html-checkboxes-be-set-to-readonly

You'd be looking for $d->option->disabled

-- hugh
 
Just for the record:

In what seems a similar case (and with a different extension), with a bit of code and CSS I've replaced certain checkboxes with what then appeared like "read-only" ones.
One could argue that it can be tricky due to different browsers rendering standard checkboxes differently, but in that case all checkboxes were "styled" with CSS anyway, so it wasn't an issue across browsers.

Could certainly be done in Fabrik as well (custom form template...) but, admittedly, it may be more or less complexity = hassle depending on the application. Advantage, if done right: the set value gets still submitted with the form.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top