How to dynamically display JSON group IDs with memberscript attributes without requiring page refresh? Answered
Can I display a JSON group ID back with a specific attribute?
I have checked this article but it's not clear how to get the ID specifically. I'm able to display every other field already.
I'm trying to display the group id back on the page

Using the memberscript with the attribute name ms-code-item-text and the value with whatever i named it
ms-code-item-textsequenceName
but i'm not sure how to display the group id specifically
Comments
4 comments
Hey Patrick Hoban, ahh now I get what you mean.
I researched on this a bit and I think there is no direct method to do this via the attribute structure. But figured a workaround for this case and was able to pull the Group ID to be displayed (#1 Screenshot).
There are multiple approaches to solve this for sure, one way is you could push the group ID value to the member json structure during form submission as a hidden value and then try to display it by using similar custom attribute with the groupID. I personally don't like storing keys as a value within a structure.
So, I took this approach:
Add the following code in your Memberscript #6 in the code you might have placed before </body> tag of the page:
For your reference, place the above code before the following line which already exists in your script:
Save the changes.
In the custom attribute of the text field where you want to show the Group ID, add a custom attribute as follows:
ms-code-item-key
groupID
Have attached a #2 screenshot for your reference as well.
Once you publish the changes, you must be able to view the group ID on the front-end.
Let me know if this helps.
Oh wow thank you so much! I'll try that out
I'm using script 2 and 6 but when i add new item it's not updates without page refresh.
Submit button has a separate attribute ms-code-update=json which was not in tutorial so i missed it
Hey Ashish Jangra, hope that resolved the issue. #6 memberscript was probably a continuation from #4 memberscript where the submit attribute setup was explained.
But for better clarity, you can check the demo project for the working version of #6 memberscript to compare the setup with. Hope this helps.
Please sign in to leave a comment.