MODX Community

How to set PAGE setting type correctly with FRED?... I'm getting error

Hello everyone !
I just started to use FRED on a new page. It is awesome.
But I have a problem when creating basic button elements, setting the PAGE attribute type for some reason returns >> http://mydomainname.com/[object Object] <<.

The element’s markup looks like this : <a href="{{buttonPage}}" class="button {{ buttonClasses }}">{{ buttonText }}</a>
And the element’s option code goes like this : `{
“settings”: [
{
“name”: “buttonText”,
“label”: “Button Text”,
“type”: “text”,
“value”: “click here”
},
{
“name”: “buttonPage”,
“label”: “Linked Page”,
“type”: “page”,
“value”: {
“id”: 1,
“url”: “[[~1]]”
}
},
{
“name”: “buttonClasses”,
“label”: “Class Options”,
“type”: “select”,
“options”: {
“primary”: “Primary”,
“primary hollow”: “Primary Hollow”,
“secondary”: “Secondary”,
“secondary hollow”: “Secondary Hollow”,
“alert”: “Alert”,
“alert hollow”: “Alert Hollow”,
“warning”: “Warning”,
“warning hollow”: “Warning Hollow”
},
“value”: “primary”
},

]
}`

Any help is greatly appreciated !!

Hi @fistudio,

Welcome to the new forums!

I think the cause is that you shouldn’t add the value there as that’s what’s returned, but it’s hard to read with your unformatted code.
To format your code, surround it with 3 backticks before and after.

It may be that you need to remove the value from the buttonPage option and change your markup to this:

<a href="{{buttonPage.url}}" class="button {{ buttonClasses }}">{{ buttonText }}</a>

Note the .url on the end.

1 Like

THANKS DigitalPenguin !!!
that did the trick.
It is working now.
I VERY MUCH Appreciate it.

PS… sorry about the code, I think this is my first post here. Still learning. :wink:

2 Likes

Glad you got it working! :slight_smile: