Developer forum

Forum » CMS - Standard features » ItemType - is it possible to combine field values into a hidden field?

ItemType - is it possible to combine field values into a hidden field?

Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi

We have an itemtype that has two values. Title and Place.

Now, I want these items to be selectable from another ItemType, as a CheckBox list.

But there is a problem. The title may be the same on many items, and the Place also - but the combination of title and place for a specific is always unique.

In order to know what is what when I select these  from the other item (in the Checkbox list), I want to combine the values of the two in a third hidden field.

Sort of what you do when naming an item like this {{Title}}, {{Place}} - but I don´t think this is possible? If not, I wil make a feature request to get this feature.

/Hans

 


Replies

 
Claus Kølbæk
Claus Kølbæk
Reply

Hi Hans

If you create the item via codefirst, it should be pretty easy to take the values and save them in a hidden field when the item is saved.

Otherwise you could possibly combine the fields when you generate your checkbox list, though that might require that you generate the list via sql.

 
Hans Ravnsfjall
Hans Ravnsfjall
Reply

Hi Claus

thank you for your reply. I haven´t tried the codefirst aproach. Will look into that.

But i am using the SQL aproach for the checkboxes. They require label and id based on already existing fields. How can i alter this? Don´t think that is possible?

/Hans

 
Claus Kølbæk
Claus Kølbæk
Reply

If I understand you correctly, it is only the visual label part you need to alter. So when you select the option for the label, you could let it be a sum of the values of 2 columns/fields. - I haven't tried it but I imagine something along the lines of: Select Title, Place, Title +' - '+ Place as TitleAndPlace From XXX- and then in this example TitleAndPlace would then be what you use as the value in label.

 

You must be logged in to post in the forum