avatar Guy C. Dev Jun 9. 2009. 3:42 pm
I am trying to change the text field displayed when you Update a User Profile found in activecollab/application/modules/system/views/users/edit_profile.tpl

I would like to make the Title field display as a textarea_field instead of a text_field. This will present an expandable text field so I can enter more text for a longer title. I have changed this code

from:
<div class="col">
{wrap field=title}
{label for=userTitle}Title{/label}
{text_field name='user[title]' value=$user_data.title id=userTitle}
{/wrap}

</div>

to:

{wrap field=title}
{label for=userTitle}Title/Description{/label}
{textarea_field name='user[title]' value=$user_data.title id=userTitle}{/textarea_field}
{/wrap}

This works. However, any currently entered text is not displayed in the text box. If you look at activecollab/application/modules/system/views/companies/_profile_form.tpl
a textarea_field is used to display the Address, and it properly displays the current Address when you edit the Company Profile. Here is the code that appears to work:

{wrap field=office_address}
{label for=companyAddress}Address{/label}
{textarea_field name='company[office_address]' id=companyAddress}{$company_data.office_address}{/textarea_field}
{/wrap}

What do I need to do so the textarea_field displays the existing value?

avatar Greg_TBone Jun 9. 2009. 9:54 pm
Guy,

It looks like the problem is where you place the smarty code to display the existing data.

The short version: for text fields, it's in the value attribute. For text areas, it's between the start and end tags.

Notice how the working example you posted has the "{$company_data.office_address}" in the middle of the {textarea_field ...} and {/textarea_field} tags? I think that's the main difference for text areas.

Hope this helps!
T-Bone Productions, Sydney Based Professional Web Development - http://www.t-bone.com.au
avatar Guy C. Dev Jun 9. 2009. 10:45 pm
Thanks for the post Greg_TBone--

I altered the code to be like the working code like this:

{wrap field=title}
{label for=userTitle}Title{/label}
{textarea_field name='user[title]' id=userTitle}($user_data.title){/textarea_field}
{/wrap}

Now It displays ($user_data.title) in the textarea, instead of the current value for that field.

Any other suggestion?

Thx -

Guy
avatar Greg_TBone Jun 9. 2009. 11:36 pm
Yes, use curly brackets instead of round ones. :-)

Anything surrounded by curly brackets in a view template file is interpreted by Smarty, which is what you want in order to display the value in the $user_data.title variable.

So you should have:

{wrap field=title}
{label for=userTitle}Title{/label}
{textarea_field name='user[title]' id=userTitle}{$user_data.title}{/textarea_field}
{/wrap}

That should be all you need.
T-Bone Productions, Sydney Based Professional Web Development - http://www.t-bone.com.au
avatar Guy C. Dev Jun 10. 2009. 6:32 am
Thanks - totally missed that one. I was doing this pretty late at night at guess I need some more rest!! I appreciate your help. It's working exactly as I wanted it to now.

Guy