This topic is locked

How can I hide certain fields on View page based on another field value

6/6/2016 12:01:59 PM
ASPRunnerPro Tips and tricks
admin

Q: I have one table which is used for archive purposes only and contains just List & View screens. On the view screen, there are a number of fields that I would like to hide Based on the value of the "Qty" field for each item.
For example, if the Field "LSFShirtQty" = 0, then I want to hide these fields - LSFStockCode, LSFDescription, LSFColour, LSFCustom, LSFShirtSize, LSFShirtCost and LSFShirtGST.
There are a significant number of items involved and I want to repeat this event for a number of items on this screen. I have tried using the attached code in a "Javascript OnLoad Event" for the View screen, but it doesn't work.
A: Javascript API won't work on View page because there are no edit controls there.
You can use BeforeDisplay event for this purpose and here is the sample code:

if values("LSFShirtQty")="0" then

pageObject.hideField("LSFStockCode")

pageObject.hideField("LSFDescription")

pageObject.hideField("LSFColour")

pageObject.hideField("LSFCustom")

pageObject.hideField("LSFShirtSize")

pageObject.hideField("LSFShirtQty")

pageObject.hideField("LSFShirtGST")

end if


More info:

http://xlinesoft.com/asprunnerpro/docs/hide_empty_fields_on_view_page.htm

S
swiersman 11/9/2016



Q: I have one table which is used for archive purposes only and contains just List & View screens. On the view screen, there are a number of fields that I would like to hide Based on the value of the "Qty" field for each item.
For example, if the Field "LSFShirtQty" = 0, then I want to hide these fields - LSFStockCode, LSFDescription, LSFColour, LSFCustom, LSFShirtSize, LSFShirtCost and LSFShirtGST.
There are a significant number of items involved and I want to repeat this event for a number of items on this screen. I have tried using the attached code in a "Javascript OnLoad Event" for the View screen, but it doesn't work.
A: Javascript API won't work on View page because there are no edit controls there.
You can use BeforeDisplay event for this purpose and here is the sample code:

if values("LSFShirtQty")="0" then

pageObject.hideField("LSFStockCode")

pageObject.hideField("LSFDescription")

pageObject.hideField("LSFColour")

pageObject.hideField("LSFCustom")

pageObject.hideField("LSFShirtSize")

pageObject.hideField("LSFShirtQty")

pageObject.hideField("LSFShirtGST")

end if


More info:

http://xlinesoft.com/asprunnerpro/docs/hide_empty_fields_on_view_page.htm

S
swiersman 11/9/2016

Can this be used to hide a DIV by it's ID?