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
TextField with type='number'
- decimal separator and validation
#241
Comments
The I'm still curious if the decimal separator can be forced to always be a point? Updated code: class MyNumberField(v.VuetifyTemplate):
label = traitlets.Unicode().tag(sync=True)
value = traitlets.Unicode(default_value='0').tag(sync=True)
min = traitlets.Float(default_value=0).tag(sync=True)
max = traitlets.Float(default_value=1).tag(sync=True)
step = traitlets.Float(default_value=0.1).tag(sync=True)
temp = traitlets.Float().tag(sync=True)
temp_error = traitlets.Any(default_value=None).tag(sync=True)
@traitlets.default('template')
def _template(self):
return '''
<v-text-field
:label="label"
type="number"
v-model="value"
@change="temp_rule"
:rules="[temp_error]"
:min="min" :max="max" :step="step"
@input="input($event)"
></v-text-field>
'''
def vue_temp_rule(self, v):
self.temp_error = None
try:
self.temp = float(v)
except:
self.temp_error = 'Input value must be a number'
def vue_input(self, data):
print(data)
mf = MyNumberField() |
I know I'm late to the party but reading this mozilla documentation, I have the feeling that the separator used by the vuetify widget is bound to the locale of your browser. @Jhsmit, have ou manage to find a solution on you side ? |
That sounds plausible as I'm having similar problems with the decimal separator if I would use excel (silly dutch use comma as decimal separator) I have found a 'solution' in the sense that I'm not using I'm now using solara to wrap their |
Hi, I've just started out with ipyvuetify and I'm looking for how to make a form for a user to input a float value.
I'm using this:
The output is this:
But when click the spinbox I get this:
Why does the type and decimal separator change here? Is there something I can do to keep the separator
.
and the value ofv_model
a float?Second, I'm trying to make it reject text or show some feedback if the value entered cannot be converted to a float. I don't have JS experience so I've scrounged the issue pages and tried the code below, but there is something with the
:rules
part that doesnt work.The text was updated successfully, but these errors were encountered: