-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to run instance.getRawValue(), please? #450
Comments
$('.superficie').toArray().forEach(function (field) {
let cleave = new Cleave(field, {
numeral: true,
numeralPositiveOnly: true,
numeralThousandsGroupStyle: 'thousand'
});
$.valHooks[`#${$(field).attr('id')}`] = {
get: function (el) {
return cleave.getRawValue();
},
set: function (el, val) {
$(el).html(val);
}
};
});
$.valHooks["#txtSuperficieConstruida"].get()
"132654" |
Thanks @xIDMONx , but it's still giving me an error A non well formed numeric value encountered after submitting the form so valHooks probably doesn't work.
|
Fixed like below, but it's definitely like solution due to lack of time... I think problem is that Controller is taking input data directly and not like after the JS.
|
Anything new about this, please? |
how to set value? |
Hi @muzaman, try the following: $.valHooks[`#${ $( field ).attr( 'id' ) }`] = {
get: function ( el ) {
return cleave.getRawValue();
},
set: function ( val ) {
cleave.setRawValue( el );
}
}
$.valHooks["#id_price"].set(123456); I hope and it works for you |
How to do this via
valHooks
, please?Basically each instance only applies to one input field, so you can run
instance.getRawValue()
to get raw value for specific input field.Originally posted by @nosir in #138 (comment)
The text was updated successfully, but these errors were encountered: