How to change field name?

prathyusha9
Kilo Contributor

Hi,

I have a field with 3 choices and 6 more fileds and if i select first choice 4 fields should be visible with some name   the field name should be changed and if i select second choice and  only 2 fileds should be visible with name changing.How can i change the field name for the choices i select

3 REPLIES 3

AbhishekGardade
Giga Sage

Hello ,

You can have a look at below docs that will help you.

Making A Field Dependent

OR

Make use of below script:

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}

//Type appropriate comment here, and begin script below
var field1 = g_form.getValue('name of field 1');
g_form.addInfoMessage(loggedInUser.u_user_category);
if(field1 =='choice 1'){
g_form.removeOption('field 2','values 1');
g_form.removeOption('field 2','values 2');

}else if(field1 =='choice 2'){

g_form.removeOption('field 2','values 1');
g_form.removeOption('field 2','values 2');
}
}

Please mark as Correct Answer/Helpful, if applicable.
Thanks!
Abhishek Gardade

 

Thank you,
Abhishek Gardade

are you able to achieve this?

Thanks,
Abhishek

Glad I could help! If this solved your issue, please mark it as Helpful and Accept as Solution so others can benefit too.*****Chavan A.P. | Technical Architect | Certified Professional*****

johnfeist
Mega Sage
Mega Sage

Hi prathyusha,

You will need to create an on change client script for the initial field with the three choices.  From there, you can use g_from.setVisible() to control what fields are seen and g_form.setLabelOf() to change the label that appears for the visible fields.

If you are showing the same fields and just making it look like the fields change because the label changes, that will work.  Otherwise, you just need to have all the fields on the form and turn them on/off as needed.

The only other alternative is to define a set of generic fields on your form and populate them when the value of the 3 choices field changes.  Then you'll need an on submit client script or a before insert/update business rule to decide what goes where into the table.

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster