Instead of text box, use option controls like dropdown list or radio buttons.

Radio Button or Drop Down List? · Formstack Blog[^]

Google on how to create these web UI.

15,906,625 members

See more:

I am working on a web-portal where my customer can order several products. The product are delivered in a multiple of 1000, 500 and 250. For a multiple of 1000, i have a code (below). For a multiple of 250 and 500, i don't have a code. Can you help me with that?

I use \d*000$ for a multiple of 1000..

I am searching for a code of multiples of 250 and 500

**What I have tried:**

I use \d*000$ for a multiple of 1000..

I am searching for a code of multiples of 250 and 500

I use \d*000$ for a multiple of 1000..

I am searching for a code of multiples of 250 and 500

I use \d*000$ for a multiple of 1000..

I am searching for a code of multiples of 250 and 500

Comments

Instead of text box, use option controls like dropdown list or radio buttons.

Radio Button or Drop Down List? · Formstack Blog[^]

Google on how to create these web UI.

Radio Button or Drop Down List? · Formstack Blog[^]

Google on how to create these web UI.

Permalink

Share this answer

v2

Comments

Member 12554033
30-May-16 4:47am

This is an option that works for me. Only when the product is available in quantities of 40.000, the dropdown list is to large

Peter Leow
30-May-16 4:57am

You cited an example "The envelopes come in order of 250 samples in a box. When you order 300, the site wil not accept it. Only a multiple of 250 samples.."

My question is why do you allow users to enter invalid number like 300 (with or without knowing that each box must contain 250 samples). If there are certain fix quantity in each box of product, state it upfront, then the users only need to enter the number of boxes that he/she want.

What do you think?

My question is why do you allow users to enter invalid number like 300 (with or without knowing that each box must contain 250 samples). If there are certain fix quantity in each box of product, state it upfront, then the users only need to enter the number of boxes that he/she want.

What do you think?

Member 12554033
30-May-16 5:29am

That is Right. Ik Think that is possible. The codes in solution 1 workes fine for me

To start with, if you want to work with Regexes, then get a copy of Expresso[^] - it's free, and it examines and generates Regular expressions.

In this case try:

In this case try:

\d*(0{3}|250|500|750)$Or

\d*(000|250|500|750)$

Permalink

Share this answer

v2

Comments

Member 12554033
30-May-16 4:46am

Great! Solution 1 works for me. Only for a multiple of 500 it doesn't

OriginalGriff
30-May-16 5:02am

Strange: I checked it in Expresso for all of them.

What values did you check for 500's?

What values did you check for 500's?

Member 12554033
30-May-16 5:30am

Ik have already solved it with: \d*(0{3}|500)

OriginalGriff
30-May-16 5:43am

Ah! I see what you mean! :laugh:

Member 12554033
30-May-16 5:31am

Thank you very much!

OriginalGriff
30-May-16 5:43am

You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject,
20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8
+1 (416) 849-8900

Can I assume that you have a text input, and when you use the data entered by the user, you want to check up (validate) the input; it should be some numeric count, multiples of 250, 500, etc.? If so, do exactly that. First, parse it as integer, and if it is parsed, take this integer and check up the value.

—SA

What have you triedso far?—SA

—SA

—SA

—SA