Clearing Elements

Folks

I have some groups that are displayed when various JS actions are performed on Y/N elements (Slide out, Slide In Etc)

The elements are DB Joins and CDD elements. I have tried doing a "clear" against the group using a check box and also attaching it to the Y/N elements but it is not working

What i need is if the Y/N element is selected to No (0), it resets the values in the DB Joins & CDD elements and clears the values

Possible?

Thanks
 
maybe with a validation on your Y/N element ?? But it's better if a more capable ( and with JS and PHP knowledge ) member help you on that
 
Folks

I have some groups that are displayed when various JS actions are performed on Y/N elements (Slide out, Slide In Etc)

The elements are DB Joins and CDD elements. I have tried doing a "clear" against the group using a check box and also attaching it to the Y/N elements but it is not working

What i need is if the Y/N element is selected to No (0), it resets the values in the DB Joins & CDD elements and clears the values

Possible?

Thanks
I'd just use a custom javascript file for the form. See: http://fabrikar.com/forums/index.php?wiki/javascript/

Maybe this example will help/inspire.
Assuming that your Yes/No element in the form is in the table 'fb_report' - And the element name is 'applied' - And your database join element that you want to 'reset' has the id 'fb_report___members'...
then your form_##.js file might look like this...

Code:
jQuery(document).ready(function()
{
 
    jQuery(document).on("click","input[name=fb_report___applied]", function()
    {
        if(jQuery(this).val() == "1")
        {
            // Here include code/functions for if label 'Yes' was just selected
        }
        else
        {
            // Here include code/functions for if label 'No' was just selected
            // e.g. This line code would deselect all of the databasejoin select options...
            jQuery("#fb_report___members option:selected").prop("selected", false);       
        }
    });
 
});


If the Yes/No element is in a repeat group, then the javascript code would need to be a little different.

You would have to use the ^ (begins with) wildcard to catch all the repeat groups.

And you would have to use a combination of closest() and find() to locate and work with only the databasejoin element in the current repeat group.

E.g....

Code:
    jQuery(document).on("click","input[name^=fb_report___applied]", function()
    {
        if(jQuery(this).val() == "1")
        {
            // Here include code/functions for if label 'Yes' was just selected
        }
        else
        {
            // Here include code/functions for if label 'No' was just selected
       
            // e.g. This line code would deselect all of the databasejoin select options
            // and assure it only affected the databasejoin in the current repeat group...
            jQuery(this).closest(".fabrikSubGroup").find("#fb_report___members option:selected").prop("selected", false);           
        }
    });
 
I have tried to resolve this with no luck - is anyone able to help at all? Thanks


Sent via my iPhone using Tapatalk app so please excuse brevity and typing errors :)
 
It's all done - thanks for the help :) - do I close this as resolved? - thanks again


Sent via my iPhone using Tapatalk app so please excuse brevity and typing errors :)
 
We are in need of some funding.
More details.

Thank you.

Staff online

Members online

Back
Top