Column number #1319
-
https://backpackforlaravel.com/docs/6.x/crud-columns#number-1 You have column number, but if I put
html5 validation don't I mean if
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You're right about the relationship between decimals and the step attribute in number fields. The HTML5 validation for number inputs requires the step attribute to match the decimal precision you want to allow. In Backpack, when using a number field, you need to explicitly set the Your implementation is correct: CRUD::addField([
'name' => 'usd',
'tab' => 'Prices',
'decimals' => 3,
'attributes' => [
'step' => "0.001",
],
'label' => 'Price in USD',
'type' => 'number',
'prefix' => '$',
'suffix' => ' USD',
]); This is consistent with the Backpack documentation and issues that have been reported. The As you correctly pointed out, the relationship between decimals and step should be:
Alternatively, you could use Note that the ℹ️ Please note our AI Bot does not reply to follow-ups, this will be the only AI answer in this thread. If the AI helped you find the answer, please mark it as answered or write details below so it can learn. Then close the conversation. If not, please give more information for when a human reads this. ℹ️ Relevant sources: Github Issue (closed): [Bug] 1-1 relationship field doesn't seem to work using class notation |
Beta Was this translation helpful? Give feedback.
You're right about the relationship between decimals and the step attribute in number fields. The HTML5 validation for number inputs requires the step attribute to match the decimal precision you want to allow.
In Backpack, when using a number field, you need to explicitly set the
attributes
with the appropriatestep
value to allow decimal inputs. Thedecimals
parameter alone won't configure the HTML input validation correctly.Your implementation is correct: