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

I would like to allow the (admin) user to set relations between two pages of cloned templates. Since the cloned pages are created by frontend processes the names are random strings. In the backend, when I want to set the relationships I see only these random string names.

First I would like to show one or more custom fields of the related template in the relation checkbox input field. So the user could see to which page he is setting a relation.

Second I would like to filter the shown pages to a subset, based on some special rules.

I tried to ceate a custom backend edit view with a custom checkbox input. I created the checkbox input with the use of <cms:pages ...> and rebuilding the automatically created structure in case of using "bound" to an editable of type "relation". But the changes are not storedn in the db.

How could I achieve this?

Kind regards,
Oliver
Hi, Oliver!

Trying to figure out a solution, I would do some tricks here. (PS. Sorry if this is irrelevant!)

1) hide the dropdown with relation field, as it can not be modified to other editables, only page name out of the box.
2) create a new dropdown with data fed from dynamic snippet
viewtopic.php?f=4&t=7565
3) with javascript onselect store new relation set after user input with cms:db_persist
If you need checkbox, I guess it also can be binded with javascript.

I don't have a full solution, but with the problem you mentioned I would go this way first.

Will be glad to learn if any other member replies here. (&& KK, of course).

PS I read again your post and it seems I didn't fully realize what is going on in your custom admin edit view. Maybe you even can generate those checkboxes titles, going with pages loop.. Custom edit should be utterly customizable, i guess.
Join COUCH:TALK channel here https://t.me/couchcms_chat
Ryazania — a framework to boost productivity with Add-ons viewtopic.php?f=2&t=13475
Support my efforts to help the community https://boosty.to/trendo/donate
@Oliver, if it is only the randomly generated names that are bothering you, instead of using _auto_title='1' (as done in the sample code at http://docs.couchcms.com/concepts/databound-forms.html), you can set the page titles to some human-readable value (e.g. a concatenation of the first and last name of the user) as shown below -
Orig:
Code: Select all
<cms:db_persist_form
    _invalidate_cache='0'
    _auto_title='1'
/>

Modified:
Code: Select all
<cms:db_persist_form
    _invalidate_cache='0'
    k_page_title="<cms:show frm_first_name /> <cms:show frm_last_name />"
    k_page_name="<cms:random_name />"
/> 

If you'd still want to create your custom markup for the relation region, I'll add to @trendoman's suggestions the following link as well - viewtopic.php?f=4&t=7971

Hope it helps.
Thank you, I think the tips could lead to a solution. I didn't know that in db_persist one can set any variable. So I could generate a custom checkbox input block using pages or related_pages, but using an "shadow" input name, and not binding this input field to the db. But after submitting the form I could persist_db and then set boundform=shadowboundform.

I will try ...
4 posts Page 1 of 1