Hidding Save Button

jmoises

Active Member
Hello how can i hidde the Save Button depending of a condition of a element?

i read some post that using javascript, i try but i think is old tread because i get errors.

thanks for any help
 
Yes, Javascript is the only way to do this.

You'll need to create a ./components/com_fabrik/js/form_X.js file (where X is your numeric form ID, which is shown in the leftmost column of your main Forms list on the backend), and create a function in it which does something like this:

Code:
function showHideSave() {
     var value = form_X.formElements.get('yourtable___yourelement').getValue();
     if (value == '1') {
         form_X.form.getElements('input[name=submit]')[0].show();
     }
     else if (value == '2') {
         form_X.form.getElements('input[name=submit]')[0].show();
     }
}

Obviously modify this to use the full element name for the element you want to use to control the hiding / showing, the values you use for hide and show, and the form_X to use the actual ID as per the file name.

Then add a JS event to your controlling element, runing either on 'click' or 'change' (you may have to experiment to see which works better, dpending on the element type), and in the JS box put:

Code:
showHideSave();

-- hugh
 
OK. If you can't get it to work, you'll need to point me at the page, by filling out your "My Sites" with at least a URL to the page, and any login I need to see the page.

-- hugh
 
Hugh, i have try many thing but i cant make it work, i explain

I have a DropDown element wiht 3 options 0=No pay, 1=Processing, 2=Pay, i am using this js code:

Code:
function showHideSave() {
    var value = form_19.formElements.get('app_facturas___forma_de_pago').getValue();
    if (value == '0') {
        form_19.form.getElements('input[name=submit]')[0].show();
    }
    else if (value == '1' || value == '2' ) {
        form_19.form.getElements('input[name=submit]')[0].hide();
    }
}

Javascript execute ok, but Value allways have value of '1',

any sugestions?

thanks
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top