Problems, need help? Have a tip or advice? Post it here.
2 posts Page 1 of 1
Hi

Is it possible to alter a couchcms variable with javascript? I am trying to filter content by a custom field, using the <cms:pages> tag, like so:
Code: Select all
<cms:pages masterpage="read.php" folder=k_folder_name custom_field="read_content_type=<cms:show user_selected_value />" paginate="1" limit="10">


My page has an html form which has two inputs: one for folder and one for my custom field. The user selects a folder and a value for the custom field, then presses submit and it then uses JS to redirect my page to a filtered version of itself, using https://my-url.com/read?f=n?my_custom_param=x. The folder filtering works perfectly well as this is built into couch, but i need to make the custom field filtering myself.

In order to achieve this, I have a custom couch variable called user_selected_value. I filter in the pages tag using custom_field= parameter. However, I can't find a way to set this user_selected_value variable from javascript when the "submit" button is pressed.

(or alternatively, using html/javascript to read the parameter from the url and then set the couch variable this way)

How can I achieve this?

Thank you
Querystring parameters must be separated by &, not ?. Here is your wrong URL:
https://my-url.com/read?f=n?my_custom_param=x


Tag <gpc> Tags Reference → gpc reads values from URL.
2 posts Page 1 of 1
cron