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

Hi,

        I want to check some condition on edit button click of a record if condition meet then only allow user to edit that record otherwise raise an exception.

        For achieve this where should i write my code so it will check that condition before Edit that record.

Ảnh đại diện
Huỷ bỏ

Nice question. I don't know how to solve it, but you need to deal with Javascript. I searched and found that when edit button is clicked the 'on_rpc_event' javascript event is called to show the 'Loading (..' instance title. I think community could help complete this piece of information, this comment may boost the replies.

Câu trả lời hay nhất

Yusuf,

If you don't want to apply constraints on click of save button, then you can use "on_change" events of the fields on which you want to apply the constraints. ochange methods will be called as and when the cursor is moved off the particular fields (or the field gets out of focus)


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

For the moment you can put all your checks in the 'write' method, get the record id and get the original record from the database by the record id and do your checks on the original record. You can then allow save process or trigger a warning message and raise an error. This gives you the same final result.

Ảnh đại diện
Huỷ bỏ
Tác giả

but in that case user will edit the record and once the save button click then only i can check the condition and give an exception. But that i don't want it. Is there any other solution to do this?

Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 2 24
26
2
thg 8 23
2874
1
thg 6 23
2344
0
thg 2 23
2056
0
thg 6 22
2012