This topic is locked
[SOLVED]

 show/hide edit/add fields with smarty

2/11/2008 2:07:29 AM
PHPRunner General questions
S
scottw author

Hi, I'm just wondering if it is possible to show or hide specific fields in the edit or add screens using the BeforeShowList events with smarty (or any other way). Whether they are visible or not will depend from a value in another table and is different for different users.
thanks in advance!

J
Jane 2/11/2008

Hi,
sure you can do it.
Edit pages on the Visual Editor tab:

...

{if $show_or_not}

<TR>

<TD width=150>field1</TD>

<TD width=250>{build_edit_control field="field1" mode="add" value=$value_field1} </TD>

</TR>

{/if}



and then assign correct value to the $show_or_not variable in the Add/Edit page: Before display event:

$smarty->assign("show_or_not",$your_value);