1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Javascript onchange readonly all fields in group not working

Discussion in 'Community' started by procajlok, Jul 14, 2022.

  1. procajlok

    procajlok Member

    Level: Community
    I have simple Javascript onchange action on calc element:

    When i choose particullary fields it's working, but on group - not. When i choose hide or show action - that work. Is there any chance to take action to all fields in group? I have up to 15 fields to readonly (if calc =1) or not readonly (if calc !=1) - for me it's 30 rows to code.

    Or maybe you would be so kind as to give me the appropriate code to do it in one item by JS code? :(
  2. lousyfool

    lousyfool Well-Known Member

    Level: Community
    Not sure if this could be your solution, but let's see:
    By default, Fabrik group elements are wrapped into fieldsets. So, with a tiny little custom JS you should be able to set the relevant group's fieldset to disabled (or not) depending on the calc element's value. See e.g. https://stackoverflow.com/questions...-an-entire-html-form-readonly#answer-17186342

    Alternatively, if you insist on readonly (or not), and with hardly any more lines of custom JS, you can do so as well, of course. You just need to get the selector(s) right. Without seeing the form, it's not simple to tell you the selector(s), of course, if that's a mystery to you.
    Either way, and just in case, note that not all form field types can be set readonly.

Share This Page