Disable the button in list record depending on a control value in the same record

I have a scenario where a list of records is displayed. For each record we have two buttons EDIT and DELETE. and several other text fields like "Status". Here depending on the value in status we have to enable and disable the buttons. I have added the following LUA script in the "OnRowWillAdd" event of the ListView. but nothing is happening.

Please let me know if there is anything wrong with the script and Suggest the ways to resolve this.

LUA Script::

local controls = thisview:getAllControls()
local status = controls.HDSChangepointApprovalStatus:getValue()
if (status=="Not Submitted") then
controls.btnEdit:setVisible(true)
controls.btnDelete:setVisible(true)
else
controls.btnEdit:setVisible(false)
controls.btnDelete:setVisible(false)
end

Have more questions? Submit a request

3 Comments

  • 0
    Avatar
    Sirisha Katragadda

    Hi Emily,

    Thanks for your reply. I tried even that i mean adding the script in the "OnLoad" event but its not working :(

  • 0
    Avatar
    gaylon_vorwaller

    If you're testing on iPhone, you have to have the "send scripts to iOS in config" checkbox checked, under app properties / server tab...

  • 0
    Avatar
    Sirisha Katragadda
    Im testin on android simulator
Please sign in to leave a comment.
Powered by Zendesk