Set/Remove "read-only" status for form fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 07:26 AM
As per my requirements I need to open existing record and disable (set "read-only" to true) all form fields.
Also there should be a button on a form which will enable (set "read-only" to false) all form fields.
I did the following:
1. Created client script that disable existing record: Gyazo - 49fb5bd9c0765865b27e304a7acd5343.png - it works fine
2. Created form button and add action: Gyazo - f1247f0b2aa73bdc99d201080434aff7.png - but it doesn't work: when I click this button - nothing happens - but it will enable all form fields for editing
Please advice where I am wrong?
Debugger doesn't stop in onClick() function
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 07:54 AM
Hi
Please try with the below code:
function onLoad(){
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 07:59 AM
Doesn't work.
I need it on onClick, not on onLoad.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 08:08 AM
HI
I think u need to use onclick event.Please find the example:
buttonRef.addEventListener("click", function() {
var fields = g_form.getEditableFields();
for (var x = 0; x < fields.length; x++) {
g_form.setReadOnly(fields[x], true);
}
}, false);
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-12-2017 08:10 AM