17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1774 Views |
-
Filling in a field automatically

7 June 2008 at 2:37am
Hi everyone.
I would like to know if it's possible to fill the Author field of the ArticlePage example (tutorial 2), automatically.
I was thinking about some way to identify the username that is adding the content (something like a $username variable), and fill the DB field with his/her username without typing it (without filling the author field with his/her name manually).Best regards.
-
Re: Filling in a field automatically

7 June 2008 at 8:18am
Yes, sure this is possible.
Just do something like this in the getCMSFields function:
$member = Member::currentUser();
$fields->addFieldToTab("Root.Content.Main", new TextField("Author", "Author", $member->FirstName . " " . $member->Surname)); -
Re: Filling in a field automatically

9 June 2008 at 10:33pm
Thanks dio5.
That's exactly what I needed.
| 1774 Views | ||
|
Page:
1
|
Go to Top |


