Community forums
Querystrings and Widget Properties
Quote from Jermaine Snipe on January 13, 2020, 1:04 pmIs it possible to pass a query string value to a widget property? For example, I have a text or number field in the widget properties and I want to pass the ID value from the current URL's query string into that property value.
Is it possible to pass a query string value to a widget property? For example, I have a text or number field in the widget properties and I want to pass the ID value from the current URL's query string into that property value.
Quote from Scott Kearney on January 13, 2020, 4:33 pmJermaine, you do have a few options -
At runtime
If it is a custom widget, then you can set the properties in the setdefaultsproperties function - you cna fectht the current URL. If it is not a custom widget, then your options are more limited, but if you just need it to be in the marku you can use a handlebars helper to output to the view, look for "registerHelper" here: https://handlebarsjs.com/guide/expressions.html#helpers
At widget package time - package up using a token that is replaced:
Jermaine, you do have a few options -
At runtime
If it is a custom widget, then you can set the properties in the setdefaultsproperties function - you cna fectht the current URL. If it is not a custom widget, then your options are more limited, but if you just need it to be in the marku you can use a handlebars helper to output to the view, look for "registerHelper" here: https://handlebarsjs.com/guide/expressions.html#helpers
At widget package time - package up using a token that is replaced: