跳至內容
選單
此問題已被標幟
2 回覆
4144 瀏覽次數

I am in a case that I need to change a field value from outside the widget (Example Browser JS Console).

I have the input id and when I change its value it is not saved on form save.

I think that the field Widget do have some events that should be called in order for the value to be registered.

To reproduce the case try just to change any form input value from the browser dev tools (inspector) and you will notice that when you save the form the value will disappear.

頭像
捨棄
最佳答案

Hello Slim

i have just applied javascript to change value of phone field on contact form.

find id of your field where you want to change value

1)  check following field has id o_field_input_53 and value is 3331.


2) now i have changed phone value and it has been changed.

$('#o_field_input_13').val('3333')
$("#o_field_input_13").trigger("change");

3)  apply $("#o_field_input_13").trigger("change"); and save record 


Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat

頭像
捨棄

we have to apply trigger change event externally

$("#o_field_input_13").trigger("change");

what if the fields inside wizard? sometimes it's work and the rest is not

作者 最佳答案

You are right this is sufficient, do you think is it possible to call widgets methods ? I think this can be helpful in other cases.

頭像
捨棄