How to automatically enter the login user name in the text field?

Automatically populate a form field with the logged-in user's name.

Overview

The form field needs to retrieve the username from the Joomla user session without allowing manual edits.
Use the {user:username} shortcode to populate the field and add the 'readonly' attribute via the Custom HTML Tag Attribute setting.

Answered
ChronoForms v7
sy sylwekb 04 May, 2021
I wanted to create a form for registered and logged in users. How to automatically enter the login user name in the text field? What code and where to enter this field when creating the form? This field is not meant to change and should be retrieved from the Joomla user base.

Greetings
he healyhatman 05 May, 2021
If it's anything like CF6 it'll be {user:username}. Should be able to just use {user:} to see the available data.
Gr GreyHead 05 May, 2021
Hi sylwebk,

Please see the 'Shortcodes Cheat Sheet' icon between the ? and X at the right of the header bar on the Forms tab.

Bob
sy sylwekb 10 May, 2021
Answer
Thank you. The described method works. Is it possible to set a greyed out field that cannot be edited? Where should I place such a text box so that users cannot edit it?
e.g.
readonly="readonly"

Works ! Behaviors --> Custom tag atribute html --> add readonly
This topic is locked and no more replies can be posted.