Disabling the submit button from XX.js

kebmsmith

Member
http://fabrikar.com/forums/showthread.php?t=25234

The above thread contains CheeseGrits useful suggestion on:
form_XX._getButton("submit").hide();

My question is whether there is something similar if you just want to disable the button rather than make it completely invisible. And, more generally, can you point me to the documentation for this whole "_getButton" return type and what methods are available therein?
--
Keb'm
 
All I can point you at is our form.js itself, which is "self documenting", ha ha ha. Meaning you can just scan through the code and find the useful looking methods.

The _getButton() is just a method we put in there as a short cut for grabbing a button DOM element, either a form submit/cancel (etc), or a button input type, by name.

You can then use any valid JS method supported by that DOM object, or set any attribute. Which, to answer you first question, would be ...

Code:
form_61.getButton('submit').disabled=true;

... which will disable the button, in this case on my form ID 61 test form. I thought it should also "grey it out" as well, but out of interest I just tried, and it didn't. So if you want it greyed out, you'd probably have to directly set the font color style attribute, or add your own class.

In case you aren't already a Firebug user ... the best way to experiment with this stuff is to install the Firebug extension in FireFox, then you can just test things out in the Firebug console. Literally just type that command above (obviously use your form_XX, it should pop it up as a "hint" when you start typing the word "form"), then try pressing the button. Then redo the command (up arrow to get the last command back), but change false to true, and try pressing it again.

-- hugh
 
Oh, and Firebug is also useful for finding the JS files as well. In the Scripts tab, just hit the script name dropdown menu, which will show you all the script files and their locations.

And if you want to actually look at our files in Firebug, you'll also have to turn Fabrik's debug mode on (via the Settings button, top right of any Fabrik backend tab), so you get the uncompressed, human readable JS files.

-- hugh
 
Just reread that, it was kind of clear as mud. So here's a video, which makes it all even more confusing. :)

Ignore the Eclipse stuff that happens in the middle, that's my PHP debugger kicking in, as I was testing something else on that page for another thread I just answered about the PHP form plugin. :)

http://screencast.com/t/bBFan2jMQ

-- hugh
 
Very cool. Thanks for all the useful info! I'll try it out. If you actually go to the form at:
www.cathyscritters.com -> Book An Event -> Private Party Reservation, you'll see I just hide it for now and have a note to the customer that it will "unhide" when they have selected enough options. Kinda' cheesy. I'll look forward to implementing these suggestions - hopefully tonight.
--
Keb'm
 
I'm not completely sure but I guess because of nowadays Bootstrap Button Layout it's rather:

buttonapply = document.getElementsByName('apply');
buttonsubmit = document.getElementsByName('Submit');

buttonapply[0].disabled = true;
buttonsubmit[0].disabled = true;


Just in Case someone's Looking for the same Thing at this exakt place ;).
Javascript's getElementsByName Method is case sensitive not only for the call but also for the parameter, it seems. Still Learning, too.

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

Thank you.

Members online

Back
Top