State visible according to country variable in form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2025 02:24 AM
I have this form in record producer , shipping country and shipping state -> select look up type -> referencing to "cmn_location" table.
I want state and city to comes according to selected country.
i.e. if i select "INDIA" in shipping country then state of India should be visible in "shipping state" variable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2025 12:25 AM
we can do it using on change client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2025 06:01 AM
can you please explain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2025 05:56 AM
This can be accomplished with a client-side script set to onChange, specifically looking at the Shipping Country field. You will want to use a Catalog Client Script since this is a record producer.
Something like this:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
// If the selected country is India, set the Shipping State to India
if (newValue == "India") {
g_form.setValue('shipping_state', 'India');
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-27-2025 06:01 AM
shipping_state is reference to cmn_location table , and I need to show all the states of India in shipping_state field