Carbon-fields: Everything is there for development .... except a simple number field

Created on 9 Mar 2018  路  3Comments  路  Source: htmlburger/carbon-fields

Hey there,
I'm using Carbon Fields since version 1.4 and the whole team did a great job with the recent version 2.1! Most of the missing features are now available, except ... a simple number field.

I mean, we have fields of the types: text, checkbox, hidden, image gallery etc, but one of the most fundamental parts is not there. That's why I'd like to request for the number type, since is very basic and important. Some big framework like Symfony supports them too (e.g. https://symfony.com/doc/current/reference/forms/types/number.html).

I know that you can add custom fields, if you want. But I have done about 3-4 projects with Carbon Fields and I always need a number type... ;)

Additionally, I think there have been many requests for this specific type of field in the past. I think it's time to add this now to close this topic forever.

[type] question

Most helpful comment

Hi @AlexBa ,

There's this:
https://github.com/htmlburger/carbon-field-number
(note that there may be issues with the latest beta - I haven't had the time to review it)

Also, you can call ->set_attribute( 'type', 'number' ) on a text field to change its input type (it won't validate the value on the back-end though but you can filter it using carbon_fields_should_save_field_value - https://carbonfields.net/docs/advanced-topics-hooks/?crb_version=2-1-0)

All 3 comments

Hi @AlexBa ,

There's this:
https://github.com/htmlburger/carbon-field-number
(note that there may be issues with the latest beta - I haven't had the time to review it)

Also, you can call ->set_attribute( 'type', 'number' ) on a text field to change its input type (it won't validate the value on the back-end though but you can filter it using carbon_fields_should_save_field_value - https://carbonfields.net/docs/advanced-topics-hooks/?crb_version=2-1-0)

@AlexBa - It appears that Atanas pushed 2.2.0 updates for the Carbon Field Number. Did either of his suggestions work for you?

I usually use ->set_attribute( 'type', ... ) if I don't need anything fancy.

Closing due to inactivity.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jonwaldstein picture jonwaldstein  路  3Comments

Roman52 picture Roman52  路  3Comments

bjoernhasse picture bjoernhasse  路  3Comments

proweb picture proweb  路  3Comments

emohamed picture emohamed  路  3Comments