How to Set a Field Value Based on Another Field in a Form?

Hi @lojainahmed,

if I understand your requirement correctly then you have to configure the first field to contain “postback=true” and add a value script to the second field (which is dependent) like in the following example:

<Field displayName="Company Id" dynamic="true" hidden="true" name="companyId" type="string">
      <Attributes>
        <Map>
          <entry key="hidden" value="true"/>
        </Map>
      </Attributes>
      <Script>
        <Source><![CDATA[
					
			String _company = null;
			_company = form.getField("company").getValue();
		        <!-- Do some logic here -->
                        return "xyz";
			]]></Source>
      </Script>
    </Field>

Best regards,
Daniel

2 Likes