NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on July 30, 2019, 01:56:23 PM
-
Hi, I need to limit the number of items inside an invoice.
How to inform the user and avoid it to add a new one?
Im using popups to update
-
Probably many ways.
One idea: count the lines in PostInsert and store the result in a sessionvalue. Then set a condition on the insert button based on that value.
Peter
-
This is such a "programmer problem".
So I'm ordering 10 items, but nooo, the software only allows "8 items per invoice". So the user has to create one invoice, then I pay that, then they make a second invoice and I have to deal with that and so on.
Alberto - you're fixing the wrong problem. Don't limit the number of items on the invoice, fix the reason they want to limit it in the first place.
cheers
Bruce
-
Bruce, Im saving in a DB thats not of my own and theyve limited the number of items of each invoice, why? I dont know but I cant save more than 22 items for the other system to work ok.
Please I need a way to limit it.
Ive tryed adding code to the preInsert and it does not work, all I could do was add code to the validateall but it only works when the user press save on the 23th item and this is no friendly.
Im using a popup form for the parent an the items browse inside it.
I thnk it will be better to control it in the parent form.
I could hide the Insert button when I enter a form with 22 items but how to hide it while the user is adding items records?
-
I guess I would add it in PreInsert.
This is a popup form right?
In PreInsert I'd do a count, and if it's over then send a script to alert the user, and click the cancel button.
But be careful that the original record buffer is restored after the count so that the insert can just continue if necessary.
What code did you try there?
cheers
Bruce
-
Thanks Bruce
In PreINsert Im trying with something like:
Table{prop:sql}='select count(*)......'
Next(Table)
If xxx>22
loc:invalid='xxx'
loc:alert='You cant...'
exit
end
but this code hangs the form
-
probably uou are assuming the table is open, or something like that....
-
No, the table is opened, Ive twicked the web1 example to show you the problem.
Attached goes the app modified just adding an embed in the form.
-
Hi Alberto,
>> and if it's over then send a script to alert the user, and click the cancel button.
seems you missed this bit. There's no scripts to alert the user or click the cancel button that I can see in your code.
cheers
Bruce
-
something like (not tested...)
p_web.popup('too many items')
p_web.script('ntd.cancel();')