Aleks
asked on
Script to allow entry in checbox equal or less than value in recordset
Within a repeat region user will enter the amount of money received, but it can only be as high as the 'balance' remaining.
If user enters a higher value it should not let him/her.
The value is: PaymentLines.Fields.Item(" Balance")
The text box where user enters the amount being received is:
<input name="amount" type="text" class="bodytext" id="item<%=(PaymentLines.F ields.Item ("Id").Val ue)%>" value="0" size="5" maxlength="10" disabled="true">
I have googled buts seems this is kind of a specific thing and could not find something this particular.
I am using classic ASP/VBscript on this page
If user enters a higher value it should not let him/her.
The value is: PaymentLines.Fields.Item("
The text box where user enters the amount being received is:
<input name="amount" type="text" class="bodytext" id="item<%=(PaymentLines.F
I have googled buts seems this is kind of a specific thing and could not find something this particular.
I am using classic ASP/VBscript on this page
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did, nothing happened. Remember this is inside a repeat region :$
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Same behavior with the last post of Gary ... no luck, the form still posts
Post your rendered HTML
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Well .. browser is not cutting it. Can we try javascript to accomplish this ?
see my first post in this thread, it's a JS based solution
ASKER
Ok. Ill try that and let you know how it works
sounds good. I'm stepping out for a bit for lunch and will check in when I get back
ASKER
Sure
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The code from Gary works great. Can we also modify the script so that it doesn't allow zero ? (It may be a negative value because of a reimbursement).
The default is zero so I want to force them to enter a value.
The default is zero so I want to force them to enter a value.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It didn't work. It allowed me to enter zero without a warning.
Also I entered a number over the max and I got the alert but it still went ahead and submitted the form
Also I entered a number over the max and I got the alert but it still went ahead and submitted the form
ASKER
In fact also the first one shows the alert but submits the form anyways.
my code pretty much did work, I just needed to force the values to a numeric type by changing the if statement to
if (parseFloat(balance) < parseFloat(amt))
if (parseFloat(balance) < parseFloat(amt))
ASKER
Actually the first entry worked without the zero validation, sorry about that one
ASKER
Ah .. I realized what happens. If I click on the button then it validates just fine (First option without the zero validation).
If I hit 'enter' then the alert comes up but the form is submitted.
???
If I hit 'enter' then the alert comes up but the form is submitted.
???
ASKER
Can we add the validation when the form is submitted instead of when the button is clicked to prevent this from happening ?
this is the form code:
<form action="SPSavePaymentLines .asp?casei d=<%=(Case sjoin.Fiel ds.Item("I d").Value) %>" method="post" name="form1" id="form1" >
this is the form code:
<form action="SPSavePaymentLines
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
There is just one issue with the javascript. Some of the fields are disabled and the default is '0' so it highlights them, it should only check on 'enabled' fields.
I tried leaving the field empty but validation will check and show red box.
It shouldn't validate if the field is disabled
I tried leaving the field empty but validation will check and show red box.
It shouldn't validate if the field is disabled
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 to both
Not sure why you are accepting comments that are wrong.
ASKER