How to populate a field on the form with the value of the variable on the form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 10:22 AM
I have a form that generates variables on the form via record producer.
The variables have the same names and values as the fields
I am looking to populate the value of the field the same as the variable
Scenario: user fills out variables saves form and I want to populate the fields.
I am using a client script but open to suggestions current script not working:
function onSubmit() {
var clientnamevalue = g_form.getValue('variables.u_client_name');
var typeofclientvalue = g_form.getValue('variables.u_type_of_client');
var typeofbreachvalue = g_form.getValue('variables.u_external_policy_breach');
var responsibleptyvalue = g_form.getValue('variables.u_type_of_breach');
var breachindividualvalue = g_form.getValue('variables.u_breach_individual');
var laepvalue = g_form.getValue('variables.u_laep');
var laeplocvalue = g_form.getValue('variables.u_laep_location_static');
var sourceofincidentvalue = g_form.getValue('variables.u_source_of_incident');
var breachcategoryvalue = g_form.getValue('variables.u_risk_consultations');
var clientnamefield = g_form.getValue('u_client_name');
var typeofclientfield = g_form.getValue('u_type_of_client');
var typeofbreachfield = g_form.getValue('u_external_policy_breach');
var responsibleptyfield = g_form.getValue('u_type_of_breach');
var breachindividualfield = g_form.getValue('u_breach_individual');
var laepfield = g_form.getValue('u_laep');
var laeplocfield = g_form.getValue('u_laep_location_static');
var sourceofincidentfield = g_form.getValue('u_source_of_incident');
var breachcategoryfield = g_form.getValue('u_risk_consultations');
g_form.setValue(clientnamefield, clientnamevalue);
g_form.setValue(typeofclientfield, typeofclientvalue);
g_form.setValue(typeofbreachfield, typeofbreachvalue);
g_form.setValue(responsibleptyfield, responsibleptyvalue);
g_form.setValue(breachindividualfield, breachindividualvalue);
g_form.setValue(laepfield, laepvalue);
g_form.setValue(laeplocfield, laeplocvalue);
g_form.setValue(sourceofincidentfield, sourceofincidentvalue);
g_form.setValue(breachcategoryfield, breachcategoryvalue);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 11:08 AM - edited 04-04-2025 11:08 AM
You can try something like in this format:
g_form.setValue('u_client_name', g_form.getValue('variables.u_client_name'));
and please add for other variables too in the above manner.
Regards,
Sai Venkaetesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-04-2025 11:22 AM
It will work but since the variable is a list collector with a variable attribute acting as a list collector
and the field is a list collector
if the variable has only 1 value it will populate the field
with more then 1 value it will populate the first value and then afterwards show random numbers that do not look like sysids but could be sysids
thoughts but on a simple 1 value this solution is perfect!