Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
7646 มุมมอง

Hello,

I am trying to create a integer field for entering phone numbers and I want to add a validation so that it would not allow to save the value if
it exceeds 10 digits. The optional size parameter seems to have no effect. How can I achieve this?

Thank You.

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

Simplest way I think would be to use an onchange-method on the field. If the value is > 10, clear the field and display a message.

The docs mention this:

on_change:

Default value for the on_change attribute in the view. This will launch a function on the server when the field changes in the client. For example, on_change="onchange_shop_id(shop_id)".

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
0
ส.ค. 19
2535
How to: Customize field validation แก้ไขแล้ว
2
ก.ค. 17
17562
2
ส.ค. 25
2395
1
ก.ค. 25
902
1
ส.ค. 25
1151