Hide submit button on edit + condition

mirceat

Member
Hello,

I've read a lot of posts about this request, but i can't find the proper javascript to hide the submit button on Edit when the textarea element is not empty.

I tried this code in form_232.js but i can't make it work so i need some help:


Code:
window.addEvent('domready', function() {
   value = form_232.formElements.get('cm_tickets___request').getValue().toInt();
user = form_232.formElements.get('cm_tickets___added_by').getValue().toInt();
   if (value > 0 && user != 256) {
      form_232._getButton('submit').hide();
   }
});

Thank you
 
do you have a URL we can look at?
At a guess I would say that form_232 is not defined and hence your code is not working.
Perhaps add at the beginning of the function

Code:
var form_232 = Fabrik.getBlock('form_232');
 
And try replacing ...

Code:
window.addEvent('domready', function() {

... with ...

Code:
requirejs(['fab/fabrik'], function () {

-- hugh
 
Thank you both for help. Please let me know if you want me to put the following issue in another topic:

In the same form, i have a group called "nobody" set for almost all elements in this form, so nobody can edit those elements no matter what. Using this access level, i get an error in Debug. Work fine if the access level is set to Public or any other group that i belong:
Code:
TypeError: document.form_232.cm_tickets___agent is undefined
element-min.js line 2 > eval:1:9
 
Are you sure? Do you have any other JS events on other elements which reference it? That error looks like it is telling us it's in code which is being eval()'ed, which means it's custom code ...

-- hugh
 
We are in need of some funding.
More details.

Thank you.

Members online

No members online now.
Back
Top