jQWidgets Forums
jQuery UI Widgets › Forums › Form › type of a number in a form
This topic contains 6 replies, has 2 voices, and was last updated by Martin 6 years, 2 months ago.
-
Author
-
Hello
Is it possible to have an input which is an Integer and not a float with NumberInput?
Like on this example :
https://stackblitz.com/github/jqwidgets/angular_demos/tree/master/form/input_types/is it possible to replace float by an integer ?
Thanks!
IS it only possible with
getComponentByName
and not a the creation of form?
Because it’s more simple at the creation… Because I know if it’s a float or integer only at the initialization…I have found a solution… But after iitialization..
In my template type is integer.
And initialized, I loop on my form wheretype == integer
And after I get the component by the name :var inputValue = form.getComponentByName('puissance') inputValue.jqxNumberInput({decimalDigits:0, groupSeparator: " ",promptChar:""})
But now, my function OnDataChange for the form doesn’t work… Why ?
Thanks a lot
I have Edit my stackblitz to show you :
https://stackblitz.com/edit/github-wzadlj
When i modify my Input Number it doesn’t work…
Sorry for 4 messages but I can’t edit…
Do you understand what I want?
Just a form with an inputNumber which is an integer ..
It’s very complexe to make that I don’t understand whyHello Paul,
You need to set the type of the field in
FormTemplateItem
to ‘number’ and not ‘integer’.
I have updated your Example.Your approach for modifying the field by
getComponentByName
is correct.Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/Ok, it works but.. I need to tell at my input what kind of it is (Integer or Float)…
And for that, i need to give a value at my template which can tell me what kind of it is..Because sometimes it’s a float, and other time an int.. Only a value in my template can tell me when I need to apply my approach for modifying the field or not
I need a field on my template like that :
{ bind: 'nubmberBoxValue', name: 'nubmberBoxValue', type: 'number', infoType:'integer', label: 'Number input', labelPosition: 'left', labelWidth: '30%', align: 'left', width: '250px', required: true },
And after I can check if
infoType
is an integer or a float.. If it’s a float I can realize your approachDo you understand my case?…
Hello Paul45,
You can create another array which will keep which number type fields are integers and which float
and check there if you need to modify the input.Please, look at the following Example.
Best Regards,
MartinjQWidgets Team
http://www.jqwidgets.com/ -
AuthorPosts
You must be logged in to reply to this topic.