cryonos
cryonos

hi everyone! I noticed that the Form number type is not available from twig, {{ form_number(...) }} give an error and I have to use the basic form_text().

What is the best way to add it?

https://octobercms.com/docs/services/html#number mention that it should be available in twig but it's not

Last updated

aram10402
aram10402

Just stumbled across this too.

Currently I am using a simple

<input type="number" id="...

Element, but I have problem getting the input into the field after validation. I'm returning to the form with

Redirect::back()->withInput()->withErrors($validator);

But I am unable to access the inputs value for my given field. Neither of those work

{{ input('my_id') }}
{{ input.get('my_id') }}
{{ input.old('my_id') }}

Sadly the documentation is not very clear about how to access the data.

aram10402
aram10402

After a bit more digging I've found a solution. There is a function called form_value which returns the data associated with the form.

<input type="number" id="my_id" value="{{ form_value('my_id') }}" />

1-3 of 3