Fabrik element with Validate Hidden = No

Hi,

When a Fabrik element has a validation set to Not empty with option Validate Hidden = No.
The element is steel mandatory when is in a hidden group of elements.

Is there a way to make the element not mandatory when is in a hidden group of element ?

upload_2022-6-10_19-29-59.png
Thank's a lot for your help.
 
How did you hide your group?
upload_2022-6-10_23-6-39.png

"Validate Hidden"=no is not working if the group is set to "display, but hidden" in group settings.
 
I assume you have a list copy and child elements (from elements where you need the validation) then? You can edit all the elements ("unlink") and remove the validation.

Or I think you can create a custom form template and add the CSS class FabrikHide to the group (I didn't test).
 
Thank you for your help, I'll try to create a JS to add CSS class FabrikHide on all elements from the hidden group.
Actually, the group has allready the CSS class :
Code:
<fieldset class="fabrikGroup fabrikHide" id="group715" style="opacity: 0; visibility: hidden;">
 
With fabrikHide added manually in the browser it's working on my site (no validation error messages for elements in the group)
upload_2022-6-13_15-34-18.png

BTW: a group "Yes, but hidden" has display:none, where is visibility:hidden coming from on your site?
 
Hi I'm trying to understand how to not validate a element when its hidden by my js element.hide(), but then make it a compulsory 'notempty' when the element is shown by js element.show().
Using F4beta with joomla4.2.5

I'm using a yesno element to trigger two field elements to show or hide
onload
yesno=0
element1.hide()
element2.hide()
(Dont validate)

onchange
yesno = 1
element1.show()
element2.show()
(Validate as notempty)

onchange
yesno = 0
element1.hide()
element2.hide()
(Dont validate)

The validate hidden = yes/no setting doesn't make a difference.
If i apply the class fabrikHide to my elements then they wont show at all.
 
I think you have to add custom JS to your element, setting class 'fabrikHide' if it's hidden and removing it on show.
 
Thanks sorry i struggle with js
I tried both methods of adding a class to the element see
https://stackoverflow.com/questions/507138/how-to-add-a-class-to-a-given-element
JavaScript:
function hidePrev(el)
{
var prevClaim = el.form.formElements.get('aaa_my_profile___prev_claim');
var prevSucc = el.form.formElements.get('aaa_my_profile___prev_success');
var prevYear = el.form.formElements.get('aaa_my_profile___year_application');
var prevTitle = el.form.formElements.get('aaa_my_profile___official_course_title');
var prevProv = el.form.formElements.get('aaa_my_profile___course_provider');


while(prevClaim.getValue() < 0.01){
    prevSucc.className += ' fabrikHide';
    prevYear.className += ' fabrikHide';
    prevProv.className += ' fabrikHide';
    prevTitle.className += ' fabrikHide';
No errors but the class name isn't applied and the elements are still showing :-(

and
JavaScript:
function hidePrev(el)
{
var prevClaim = el.form.formElements.get('aaa_my_profile___prev_claim');
var prevSucc = el.form.formElements.get('aaa_my_profile___prev_success');
var prevYear = el.form.formElements.get('aaa_my_profile___year_application');
var prevTitle = el.form.formElements.get('aaa_my_profile___official_course_title');
var prevProv = el.form.formElements.get('aaa_my_profile___course_provider');


while(prevClaim.getValue() < 0.01){
    prevSucc.classList.add("fabrikHide");
    prevYear.classList.add("fabrikHide");
    prevProv.classList.add("fabrikHide");
    prevTitle.classList.add("fabrikHide");
Which leads to error in the console
Code:
form_1.js:32 Uncaught TypeError: Cannot read properties of undefined (reading 'add')
    at hidePrev (form_1.js:32:24)
    at eval (eval at runLoadEvent (element.js:3:2812), <anonymous>:1:1)
    at Object.runLoadEvent (element.js:3:2812)
    at s.extend.$owner (mootools-core.js:3:17367)
    at Object.addNewEvent (elementlist.js:3:881)
    at s.extend.$owner (mootools-core.js:3:17367)
    at Object.dispatchEvent (form.js:3:15033)
    at s.extend.$owner (mootools-core.js:3:17367)
    at 1:2169:8
    at Object.execCb (<anonymous>:29:311)
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top