The CreatorCon Call for Content is officially open! Get started here.

How to get Check box field label instead of true or false

vijay39
Giga Expert

Hi guys,

I created a record producer on Request table. In that record producer, there are 10 check boxes, and the same 10 check boxes I created in request table, so that the values reflects here also in request table. Now my requirement is if the end-user selects 8 check boxes then usually in the request table the 8 check boxes will be checked. But in catalog task table I want all the 8 values in a single field with comma separated. Please note I want check box labels with comma separated. Like check boxes are USA, Australia, India etc.. I want them to be in a single field with comma separated in catalog task table. Please someone help me here. This is urgent requirement

 

Regatds,

Vijay

1 ACCEPTED SOLUTION

I believe you should create a field(always hidden) on RP to store this resultant string. If it is ok for you, then the following answer works for you.

//onSubmit Catalog Client Script

var arr = [];
var res='';
if(g_form.getValue('cbox_1'))
arr.push(g_form.getLabel('cbox_1'));
if(g_form.getValue('cbox_2'))
arr.push(g_form.getLabel('cbox_2'));
''
''
''
if(g_form.getValue('cbox_8'))
arr.push(g_form.getLabel('cbox_8'));
for(var i=0;i<arr.length;i++)
{
res += arr[i];
}
g_form.setValue('your_new_hidden_string_field',res);


//But in order to hide this field all the time, you should mention the below line in every Client Script written on that RP
//Line of code to be written in isLoading part

g_form.setDisplay('your_new_hidden_string_field',false);
//Mark sure this newly created field is mapped to 'String' field in Request table

Hope this helps!!

Thanks,

Archana

View solution in original post

8 REPLIES 8

Hi Archana,

 

Thanks for responding. Actually the requirement has changed today. In a record producer i created  10 check boxes. So now my requirement is, if the end-user selects 7 check boxes then only the selected check boxes labels must be displayed in a String field with comma separated in Request table. I think i have to glide record item_option_new table and using for loop i should get the labels whichever are true and push them into an array. But not understanding how to do this. Can you help me?

 

 

Regards,

Vijay

 

I believe you should create a field(always hidden) on RP to store this resultant string. If it is ok for you, then the following answer works for you.

//onSubmit Catalog Client Script

var arr = [];
var res='';
if(g_form.getValue('cbox_1'))
arr.push(g_form.getLabel('cbox_1'));
if(g_form.getValue('cbox_2'))
arr.push(g_form.getLabel('cbox_2'));
''
''
''
if(g_form.getValue('cbox_8'))
arr.push(g_form.getLabel('cbox_8'));
for(var i=0;i<arr.length;i++)
{
res += arr[i];
}
g_form.setValue('your_new_hidden_string_field',res);


//But in order to hide this field all the time, you should mention the below line in every Client Script written on that RP
//Line of code to be written in isLoading part

g_form.setDisplay('your_new_hidden_string_field',false);
//Mark sure this newly created field is mapped to 'String' field in Request table

Hope this helps!!

Thanks,

Archana

Thank you Archana,

Actually i tried differently yesterday itself and its working.

But this code you sent me also working but its hard coded. right?

Anyway Its working and thank you very much for your help.

 

 

 

Regards,

Vijay

Glad you got it and share the other solution you have as well. It may help others 🙂