This topic is locked

ADD/EDIT PAGES

8/4/2008 12:56:30 PM
PHPRunner General questions
G
garethp authorDevClub member

Hi
I am not sure if this is possible - I have tried searching but have got myself very confused.
I have a table por_details with 2 fields part and description.
I only want a user to see the description field on the add/edit page if part = "MISC" and if the part field is any other value then not be visible on the add/edit pages.
Is this possible?
Thanks
Gareth

J
Jane 8/5/2008

Gareth,
To hide field on the Edit page edit this page in HTML mode on the Visual Editor tab.

Here is a sample:

{if $value_part=="MISC"}

<TR

style="PADDING-RIGHT: 3px; PADDING-LEFT: 3px; PADDING-BOTTOM: 3px; PADDING-TOP: 3px">

<TD width=150>description</TD>

<TD width=250>{build_edit_control field="description" value=$value_description mode="edit"}

</TD></TR>

{/if}


I'm not sure how to hide field on the add page because there are no any values yet.

G
garethp authorDevClub member 8/5/2008

Hi Jane
Thanks for the reponse
Is there no way of going it 'live' on the add/edit page - to make the field appear and disappear depending on the part field value?
Sound complicated but jsut thought I would ask!
Thanks
Gareth

J
Jane 8/5/2008

Gareth,
you can select field value on the Edit page: Before process and then create new smarty variable:

$var = $smarty->get_template_vars("value_FieldName");

$var = substr($var,0,4);

$smarty_assign("value_FieldName_part".$var);



Then use $value_FieldName_part on your edit page on the Visual Editor tab.

G
garethp authorDevClub member 8/5/2008

thanks jane