Have you checked out the validate plugin?
http://plugins.jquery.com/project/validate

Their is a method they have where you can actually run an ajax call to
your server to check for a valid input, or you could use it with your
statically set value as you have already done.



On May 6, 1:01 pm, jpl80 <[EMAIL PROTECTED]> wrote:
> I need to validate some dynamically generated form data to ensure clients
> can't order more of something than we have in stock. I can't set static
> comparisons. Here is my html:
>
> <form action="addtocart.php" method="post">
> <input type="submit" class="addtocart" value="add selected items to cart" />
>
> <div class="instock">
>   <h4>manual 1</h4>
>   <div class="qty" title="90">90</div>
>   <input name="150" type="text" id="150" class="order-qty" /><label
> for="150">Qty:</label>
> </div>
>
> <div class="instock">
>   <h4>manual 2</h4>
>   <div class="qty" title="48">48</div>
>   <input name="151" type="text" id="151" class="order-qty" /><label
> for="151">Qty:</label>
> </div>
>
> </form>
>
> I want to validate on keyup(). In rough pseudocode, something like this:
>
> $(document).keyup(function(event){
>   if (($this.getValue(input)) > ($this.getValue(span.qty))) {
>     addText("Not enough in stock");
>   }
>
> });
>
> I know that's not even close. Could someone help me?
> --
> View this message in 
> context:http://www.nabble.com/validating-dynamically-generated-data-tp1709106...
> Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to