Choice list
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2023 11:04 PM
Hi Community ,
I have urgent requirement on :
1.I need Convert one free text field (e.g abc) to a drop down with some options.
2.These dropdown/choices should be visible only for particular model category. ( e.g the drop down should be visible only for model category is computer & for rest of the model category it should be free text only)
3.When this(abc) field will populate another filed xyz should get mandatory and when xyz filed will get polulate the abc filed should be mandatory.
How to achieve this?
Thanks,
Manu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2023 11:30 PM - edited 11-05-2023 11:35 PM
Hi @Manu143 ,
Do u need to do this on catalog item form?
If yes you can have 2 different fields instead of 1 (1st field as single line text & 2nd field as drop down) & you can hide Unhide the required field based upon Ui policy / Client Script.
In order to make it mandatory & non mandatory u can write an on Change client script on the both the field (abc & xyz) like
if(newValue != ''){
g_form.setMandatory('xyz',true);
}else{
g_form.setMandatory('xyz',false);
}
Above script needs to be created for both field on change.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2023 11:36 PM
I want this on alm hardware form. That free text filed is already there I just need to show some choices for that filed only for model category is computer. I have added choices to field from dictionary but not getting how to make those visible only for computer.
Thanks,
Manu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-05-2023 11:42 PM - edited 11-05-2023 11:42 PM
Hi @Manu143 ,
In the choice field dont add any choices by default. You can write an on Change client script on alm hardware table on model category field , something like below.
if(newValue == 'Computer'){ // Use proper backend name of the computer value
g_form.addOptions('model_category','Option1');
g_form.addOptions('model_category','Option2');
g_form.addOptions('model_category','Option3');
}else{
g_form.removeOptions('model_category');
}
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2023 03:06 AM
Hi