- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-04-2024 12:51 PM - edited 09-04-2024 01:16 PM
There is a field within the idea portal called "Idea Category".
I have a request to add the "Idea Category" field to the idea form "idea.do".
I need the value in the form to be equal to the selected "Idea Category" chosen during the idea creation within the portal.
Field "Idea Category" exists within the "im_m2m_idea_category" table.
Failed to accomplish this request using form layout, form design or form builder.
Any attempts to build many to many relationships or reference qualifiers have also ended in failure.
What is the correct way to accomplish this request?
Why is "Idea Category" not available as a dot walkable field within configure idea form?
Attempted So Far
- Create many to many relationship between table "im_m2m_idea_category" and table "idea"... add new value as reference value to form (this fails to actually fill the value with the selected category but does allow the user to select a new one).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 11:57 AM
Try this approach:
- Create a UI Macro named "idea_categories"
<?xml version="1.0" encoding="utf-8" ?> <j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null"> <!-- Get the categories --> <g2:evaluate var="jvar_categories" object="true"> var imIdeaCategory = new global.IMIdeaCategory(); var categories = imIdeaCategory.getCategoriesForIdea(current.getUniqueValue()); var categoryList = []; if (Array.isArray(categories)) { categories.forEach(function(category) { if (category.hasOwnProperty('name')) { categoryList.push(category.name); } }); } categoryList; </g2:evaluate> <!-- Display the categories --> <div class="idea-categories clearfix"> <div class="label_spacing"> <label dir="ltr" class="control-label col-xs-12 col-md-1_5 col-lg-2 col-xs-12 col-md-1_5 col-lg-2"> <span class="category-title">Categories</span> </label> </div> <div class="col-xs-10 col-md-9 col-lg-8"> <j2:forEach items="$[jvar_categories]" var="jvar_category"> <span class="category-badge">$[jvar_category]</span> </j2:forEach> </div> </div> <!-- Styles for the category buttons --> <style> .idea-categories { margin: 0 0 10px; } .category-badge{ color: #2e2e2e; background-color: #f5f5f5; padding: 5px 10px; display: inline-block; border: 1px solid #ddd; border-radius: 4px; margin-right: 5px; margin-bottom: 10px; } </style> </j:jelly>
- Create a UI Formatter (the value in "Formatter" must match the name of the UI Macro)
- Add the "Categories" formatter to the Idea form (probably under "Title")
Good luck!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2024 12:42 PM
Thank you again for all of your help!
This worked exactly as you described.