NetTalk Central

Author Topic: issues with disabling Save button  (Read 3419 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
issues with disabling Save button
« on: March 15, 2022, 11:11:11 AM »
Hi Bruce,

     I'm having an issue with disabling the Save button on a form, or setting the form to View Only mode.  My app is C 11.0.13505 with NT 12.19.

     I want to prevent the users from saving the form unless they enter some specific data.  I have tried the following methods:

1.  Disabled the Save button with the Disable If condition on the Save button tab.  This causes the Save and Cancel buttons to be disabled as expected. 

In an embed, I then use the following to conditionally re-enable the Save button:

                        p_web.ntForm(loc:formname, 'enableSave'). 

     The Save button is enabled again but the Cancel button remains disabled.

2.  I set the form to View Only mode on the Security Tab with the condition:

                        p_web.GSV('PatMKD:EDC_STATUS') <> 'On Study'

The form now only has a Close button, and is View Only, as expected.  When I use loc:viewonly = FALSE in an embed, the form is now back in insert mode but the Save and Cancel buttons do not return.  The Close button remains.

I suspect I need to reset/refresh/redraw the form with some command in my conditional embed code.  Any thoughts on were I have gone wrong here?

Thanks,

Jeff King

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: issues with disabling Save button
« Reply #1 on: March 15, 2022, 11:44:20 AM »
Hi,
What if you disable the Save butto using:

p_web.ntForm(loc:formname, 'disableSave') ?

and then enable it when you need?

Regards
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: issues with disabling Save button
« Reply #2 on: March 15, 2022, 09:51:04 PM »
Hi Jeff,

Your approach to switch from View-Only to Insert etc won't work. So you can abandon that approach.

>> Disabled the Save button with the Disable If condition on the Save button tab.  This causes the Save and Cancel buttons to be disabled as expected. 

I would not expect that to disable the Cancel button - I'll look into that.

In the meantime use Alberto's suggestions.

Cheers
Bruce

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: issues with disabling Save button
« Reply #3 on: March 16, 2022, 08:59:42 AM »
Bruce,

   Thanks for the reply.  I did mis-type, I meant to say the Save button is disabled as expected.  As you mentioned, the Cancel button should not be disabled.

     I did try Alberto's suggestion and it did work.  Thanks Alberto!

Jeff