disable readonly field property

jbadiag

Member
Hi, in my fabrik older version I had in a field javascript properties onchange this code:
Code:
var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth() + 1;
var curr_year = d.getFullYear();

$('socios_aprovacion___f4').readOnly = false;
$('socios_aprovacion___f4').value= curr_date + '/' + curr_month + '/' + curr_year;
$('socios_aprovacion___f4').readOnly = true;
So when I changed the dropdown it wrote the date in a field and put that field in readonly property again.

but in the new version of fabrik does not work. Does I need to change anything?
 
I'd have to see the page.

In general, you shouldn't set Fabrik value using the jQuery selector property, rather do it with the Fabrik pbject update() method, like ...

Fabrik.getBlock('form_X').formElements('socios_aprovacion___f4').update(... whatever ...);

... although if it's a simple field element, that probably isn't your problem.

-- hugh
 
Thanks, but my first problem comes when I try to disable the "readonly" property.
With the older version o fabrik it worked. Now don't, so I just need the new way to change this property.
Thanks
 
Use jQuery prop() ...

Code:
jQuery('#socios_aprovacion___f4').prop('readonly', false);

... and true to set it readonly again.

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

Thank you.

Members online

No members online now.
Back
Top