NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: jking on July 16, 2018, 09:39:19 AM

Title: disable Insert button
Post by: jking 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
Title: Re: disable Insert button
Post by: Alberto on July 16, 2018, 10:03:06 AM
Why not to use the Insert Button Condition?
See image
Title: Re: disable Insert button
Post by: DonRidley 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
Title: Re: disable Insert button
Post by: jking 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