pjohns
8th April 2011, 12:24
Hello,

What's the best way to restrict what gets entered in a form field?

I have a session where the user needs to enter a warehouse code. The form field is linking through to the tcmcs warehouse table but the user should only be allowed to select certain warehouses.

Any examples you can provide will be appreciated.

Thanks

PJ

sameer.don
8th April 2011, 12:44
you can use subsection check.input for this purpose


field.cwar:
check.input:
if cwar = "WR1" or cwar = "WR2" pr cwar = "WR3" then
set.input.error("<message_code>")
endif

pjohns
8th April 2011, 14:05
Thanks for your reply.

I did try the following but the error message came up regardless of what warehouse code I used.

field.tdilc920.cwar:
check.input:
if tdilc920.cwar <> "933" or tdilc920.cwar <> "93Q" then
set.input.error("")
message("Warehouse must be 933 or 93Q")
endif

I changed to the following and it works.

field.tdilc920.cwar:
check.input:
if not (tdilc920.cwar = "933" or tdilc920.cwar = "93Q") then
set.input.error("")
message("Warehouse must be 933 or 93Q")
endif


On another note before I linked a program script to my session the form would show the description of the selected warehouse as a "display" field next to the cwar input field. The description no longer displays do I now have to put this functionality in the script?

Edit: I've now resolved the issue of the description text not appearing. Thanks

Thanks (from a novice Baan programmer :o)

sameer.don
11th April 2011, 08:21
What is the name of field you are using for warehouse description?

Have you checked reference from field tdilc920.cwar??
If this fields has a refernec to tcmcs003.cwar [warehouse], the you need not write code for displaying warehouse description. You can use field tcmcs003.dsca on your form.

pjohns
11th April 2011, 09:38
It's working now.

Thanks