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

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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

#1 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 15310
  • Joined: 03-February 03

Posted 06 June 2016 - 04:01 PM

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...n_view_page.htm
Best regards,
Sergey Kornilov
0

#2 User is offline   swiersman 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 40
  • Joined: 14-July 06

Posted 09 November 2016 - 06:57 PM

View Postadmin, on 06 June 2016 - 11:01 AM, said:

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...n_view_page.htm

0

#3 User is offline   swiersman 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 40
  • Joined: 14-July 06

Posted 09 November 2016 - 07:00 PM

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

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic