Accessing the UI Macro - List field in client script on the standard change record producer / must contain > 2 changes


 





(note the out of the box field has been re-labelled slightly in this example)

within the UI macro:
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<j:set var="jvar_html_identifier" value="std_change_proposal.change_requests"/>

-->  g_form.getValue('std_change_proposal.change_requests'); will work in the onsubmit client script

example to prevent submission if the field contains less than 3 changes

function onSubmit() { var field_name = 'std_change_proposal.change_requests'; var msg = getMessage('chg.std_chg_proposal'); var sample_chg_reqs_field = g_form.getValue(field_name); if ((sample_chg_reqs_field.match(/,/g) || []).length < 2) { g_form.addErrorMessage(msg); alert(msg); g_form.hideFieldMsg(field_name); g_form.showFieldMsg(field_name, msg, 'error', true); return false; } else { g_form.hideFieldMsg(field_name); } }

Comments

Popular posts from this blog

GlideRecord setValue

variable advanced reference qualifier example

URL link in addInfoMessage