CMS Version 1.4.1
FrontEndUsers 1.5.3
SelfRegistration 1.2.1
CustomContent 1.5
FormBuilder 0.5.5
FormBrowser 0.2.3
Hello everybody,
I have created a Form with FormBuilder with several fields. One of them is an hidden field, where I want to store the information of the logged username.
After searching some information on the forum, I decided to created a GBC as follow.
Global Content Blocks:
{global_content name='client_username_annonce'}
with GBC defined with
{cms_module module=CustomContent}{$customcontent_loginname}
In the Formbuilder hidden field, I put the tag {global_content name='client_username_annonce'} and I checked the field "Process smarty tags within field?" in the advance settings of the hidden field.
While editing the source code of my web page, I have got following error for the hidden field:
Why did I get such error?
Is my GCB wrongly writtent?
Moreover is there another way to pass the logged username to an hidden field?
Thanks in advance for any advice.
Cheers,
Apo
[SOLVED] Passing logged username to an hidden field
[SOLVED] Passing logged username to an hidden field
Last edited by apo666 on Thu Nov 20, 2008 12:19 am, edited 1 time in total.
Re: Passing logged username to an hidden field
USING MODULE FORMBUILDER :
I have made different testings, and I followed indication on this topic : http://forum.cmsmadesimple.org/index.php?action=post;topic=27774.0;num_replies=0
In FormBuilder I have a Form called "customertable". Inside this table I have an hidden field where I wanted to pass the logged username. This hidden field is named linkfiedlcustomerlogged.
Then in my page I added following code (set to off the WYSIWYG) :
{cms_module module=CustomContent} {if $ccuser->loggedin()}
{cms_module module='FormBuilder' form='customertable' value_linkfiedlcustomerlogged=$customcontent_loginname}
{else}
Please log in....
{/if}
Additionnaly, here is the configuration of the hidden field linkfiedlcustomerlogged on my FormBuilder:
The Value field is empty.
NOTE 1 : Do not forget to set to OFF the cache on the page option, because if you reload the Form, the $customcontent_loginname is not passed again.
USING MODULE FORMBROWSER :
In that case, and using following code inside the another page :
{cms_module module=CustomContent} {if $ccuser->loggedin()}
{cms_module module='FormBrowser' browser='customertable'}
{else}
Please log in....
{/if}
This calls the same form as FormBuilder method, but field linkfiedlcustomerlogged is not set to logged user, because I don't know were to pass it.
NOTE 2 : In that case, passing a tag directly to hidden field linkfiedlcustomerlogged value with $customcontent_loginname seems to be the best/unique solution.
QUESTION : Does anyone know how to add/pass the $customcontent_loginname tag directly to the hidden field on the form?
In my case, I use both module FormBuilder and FormBrowser.
Thanks in advance.
Apo
I have made different testings, and I followed indication on this topic : http://forum.cmsmadesimple.org/index.php?action=post;topic=27774.0;num_replies=0
In FormBuilder I have a Form called "customertable". Inside this table I have an hidden field where I wanted to pass the logged username. This hidden field is named linkfiedlcustomerlogged.
Then in my page I added following code (set to off the WYSIWYG) :
{cms_module module=CustomContent} {if $ccuser->loggedin()}
{cms_module module='FormBuilder' form='customertable' value_linkfiedlcustomerlogged=$customcontent_loginname}
{else}
Please log in....
{/if}
Additionnaly, here is the configuration of the hidden field linkfiedlcustomerlogged on my FormBuilder:
The Value field is empty.
NOTE 1 : Do not forget to set to OFF the cache on the page option, because if you reload the Form, the $customcontent_loginname is not passed again.
USING MODULE FORMBROWSER :
In that case, and using following code inside the another page :
{cms_module module=CustomContent} {if $ccuser->loggedin()}
{cms_module module='FormBrowser' browser='customertable'}
{else}
Please log in....
{/if}
This calls the same form as FormBuilder method, but field linkfiedlcustomerlogged is not set to logged user, because I don't know were to pass it.
NOTE 2 : In that case, passing a tag directly to hidden field linkfiedlcustomerlogged value with $customcontent_loginname seems to be the best/unique solution.
QUESTION : Does anyone know how to add/pass the $customcontent_loginname tag directly to the hidden field on the form?
In my case, I use both module FormBuilder and FormBrowser.
Thanks in advance.
Apo
Re: [HALF-SOLVED] Passing logged username to an hidden field
Here is the solution which works for my case.
Create a UDT tag named "return_logged_username"
global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
$username = $feusers->LoggedInName();
return $username;
Then put {return_logged_username} in the hidden field value that you defined in the with FormBuilder.
You can then use only :
{cms_module module='FormBuilder' form='customertable'}
instead of
{cms_module module='FormBuilder' form='customertable' value_linkfiedlcustomerlogged=$customcontent_loginname}
See you...
Apo
Create a UDT tag named "return_logged_username"
global $gCms;
$feusers = $gCms->modules['FrontEndUsers']['object'];
$username = $feusers->LoggedInName();
return $username;
Then put {return_logged_username} in the hidden field value that you defined in the with FormBuilder.
You can then use only :
{cms_module module='FormBuilder' form='customertable'}
instead of
{cms_module module='FormBuilder' form='customertable' value_linkfiedlcustomerlogged=$customcontent_loginname}
See you...
Apo