NetTalk Central

Author Topic: disable Insert button  (Read 5179 times)

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
disable Insert button
« on: July 16, 2018, 09:39:19 AM »
I would like the average user to only be able to enter one record in a browse.  Based on a previous post of mine, I'm trying to use the loc:found variable.  In the End of BrowseTable routine, I embed code to test this variable and set a session variable to be used on the Insert button conditional display field in the templates.  For example:

If loc:found = 0
     p_web.SSV('DisableInsertButton', 'No')
END

This seems to work within a specific session, but if I close everything and start again, the Insert button shows again.  Basically I want the Insert button to appear if there are no records and then be disabled if there is one record entered.  Is there a better embed to use?  Maybe an alternative solution?

Thanks,

Jeff King

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: disable Insert button
« Reply #1 on: July 16, 2018, 10:03:06 AM »
Why not to use the Insert Button Condition?
See image
-----------
Regards
Alberto

DonRidley

  • Don Ridley
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 729
  • donaldridley2011@gmail.com
    • View Profile
    • Email
Re: disable Insert button
« Reply #2 on: July 17, 2018, 02:01:48 AM »
I have done something like this.

In a page loaded browse, set the number of rows per page to display to one. 

Then use your condition in the insert button condition.

I'm not sure you need to use a session value though since we're still in the scope of the local browse procedure.  Seems like my display condition was simpler.  I look at it a little bit when I get to my deveplopment machine.

Don
"Eliminate the impossible, whatever remains, however unlikely, must be the truth."

NetTalk 12.55
Clarion 11

jking

  • Sr. Member
  • ****
  • Posts: 419
    • View Profile
    • Email
Re: disable Insert button
« Reply #3 on: July 17, 2018, 09:26:03 AM »
Thanks guys.  After some experimenting, I have the effect I'm looking for by simply adding the following condition on the Insert button:

  loc:rowcount = 0

One anomaly I see is that the Insert button is hidden even if I select "Disable".  Not a big deal though.

Thanks,

Jeff