Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
7657 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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)".

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
0
thg 8 19
2538
2
thg 7 17
17566
2
thg 8 25
2403
1
thg 7 25
908
1
thg 8 25
1151