Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I couldn't find anything on this on the forums or google, I'm creating pages on a cloned template, the template has a relation to the extended user template of many to one:

Code: Select all
<cms:editable type='relation' name='ticket_user' masterpage='users/index.php' has='one' label='Ticket Relation' desc='Which user does ticket belong to?' />


Now creating a new cloned page works fine using databound forms but I cannot populate the relation automatically.. The logged-in user creating the page should be assigned to the relation.
I tried just submitting a global variable and when that didn't work I tried the below input:

Code: Select all
<cms:input type="hidden" value="<cms:show k_user_title />" name="username" />


along with:

Code: Select all
    <cms:db_persist_form 
        _invalidate_cache='0'
        _auto_title='1'
      status='Open'
      ticket_user=frm_username
    />   


but ticket_user is never filled, perhaps this is not possible within db_persist_form? I've never tried to automatically assign a relation like this before. Any thoughts?
Image
Hi, now we are talking :)

The logged-in user creating the page should be assigned to the relation.

Relation fields require IDs, so it should be like ticket_user=k_user_id
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
You are wonderful, thank you :lol: I was scratching my head at that for some time!
Image
Bartonsweb wrote: You are wonderful, thank you :lol: I was scratching my head at that for some time!

Welcome. Don't waste time, come to chat with anything that takes more than 5 minutes to figure out :)
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
4 posts Page 1 of 1