This topic is locked

Conditional Edit Form Fields

11/22/2008 11:51:29 AM
ASPRunnerPro General questions
D
dmulberry author

I have a scenario where I want to use one edit form but conditionaly only display certain form fields based on the type of record being edited. I can not solve this with DB design as I don't control the DB side of things. These records are property records and only certain fields woulb be visible for certain property types (i.e. Office, Land, Industrial). Some fields are relevant to all property types and others are relevant to only one or two property types.
So here is what I thought would work:
1 - Create event on "Edit page: Before Display" and add smarty variables:
smarty.Add "property_indOff", dict("IndOffLand")="Industrial" or dict("IndOffLand")="Office"

smarty.Add "property_industrial", dict("IndOffLand")="Industrial"

smarty.Add "property_office", dict("IndOffLand")="Office"

smarty.Add "property_land", dict("IndOffLand")="Land"

smarty.Add "property_indLand", dict("IndOffLand")="Industrial" or dict("IndOffLand")="Land"
2 - use if / then statement in HTML view of edit page
i.e. {if $property_land} display row {/if}
Unfortunately this is not working. Anything between my if statements does not show up on the edit form regardless of the property type.
If there is an easier way to do this or if you could help me make this work it would be much appreciated.

J
Jane 11/24/2008

Hi,
what ASPRunnerPro version do you use?

D
dmulberry author 11/24/2008

Hi,

what ASPRunnerPro version do you use?


5.2 but if upgrading will help solve the problem I would consider it

J
Jane 11/24/2008

Hi,
this code should work for ASPRunner 5.2.

Please publish your project on Demo Account and send to support@xlinesoft.com a URL to your pages along with instructions on reproducing this error.

I'll find what's wrong with your project inspecting it at Demo account site.