hidrau
asked on
How can I accept only a value valid in my input?
Hello,
I have a input and I suggest a value, for example:
200
this field only must accept a multiply value from itself or divided by itself.
Then
It only can accept: 200 - 400 - 600 - 800 - 900 etc
thanks
Alex
I have a input and I suggest a value, for example:
200
this field only must accept a multiply value from itself or divided by itself.
Then
It only can accept: 200 - 400 - 600 - 800 - 900 etc
thanks
Alex
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Friend, I don't know much JS, could you give an example how to create this function with a field?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
ASKER
Hi Cluskitt,
I notice that If I insert a value 500 it pass and it doesn't.
only value = my suggested value or multiply by itself
I notice that If I insert a value 500 it pass and it doesn't.
only value = my suggested value or multiply by itself
I thought you meant only increments of the value or increments of half the value.
Just change the if to:
if (FieldValue % MyValue == 0 || FieldValue == MyValue / 2)
Just change the if to:
if (FieldValue % MyValue == 0 || FieldValue == MyValue / 2)
if (fieldvalue % suggestedvalue == 0)