In the cookbook (http://wnframework.readthedocs.org/en/latest/client_side_cookbook.html#form-events-triggers) I have found that one can add general form triggers for "refresh", "onload" and "setup", e.g. "cur_frm.cscript.refresh = function()". However I need an "onchange" trigger for a specific text input field, as described here: http://www.w3schools.com/jsref/event_onchange.asp
I tried the following:
cur_frm.cscript.amount_allocated_on_permit.onchange = function() {
cur_frm.set_value("total_amount_lawfully_used", 999);
refresh_field("total_amount_lawfully_used");
}
but nothing happens, the onchange isn't added to the "amount_allocated_on_permit" text field.
I need this, because I want to recompute parts of the form when the user changes some elements. I am trying to avoid adding a "recompute" button, because that spoils the user's interactive experience. Therefore I need a trigger that is called when the user made some changes in the form input.
Thank you,
For onchange trigger you should write the function with a little chnage:
cur_frm.cscript.amount_allocated_on_permit = function() {
cur_frm.set_value("total_amount_lawfully_used", 999);
}
You do not need to refresh field, as set_value function automatically refresh after setting the value.
It does trigger once when the form loads, but I can't get it to trigger again.
–
Note:
If you are posting an issue,
- We should be able to replicate it at our end. So please give us as much information as you can. Please see it from the point of view of the person receiving the communication.
- Paste your code at http://pastebin.com or http://gist.github.com and send only the URL via email
- For sending images, use http://imgur.com or other similar services. Do not send images as attachments. Links are good. Same goes for any file you are going to send.
End of Note
—
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer-forum+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/37a95255-0c6c-4e07-b4ff-237520a82815%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.