[jQuery] Re: validating dynamically generated data
pedalpete wrote: 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. I've looked at that. But data I need to compare is right there on the page! All I want to do is say: On keyup () { var x = getCurrentValue(input); var y = getCurrentValue(div.qty); if (x y) { error(not enough in stock); } } -- View this message in context: http://www.nabble.com/validating-dynamically-generated-data-tp17091060s27240p17104102.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Re: validating dynamically generated data
I figured it out... mostly: $(document).ready(function() { $(div.instock input.order-qty).keyup(function(){ var x = parseInt($(this).val()); var y = parseInt($(this).siblings(span.qty).attr(title)); if (x y) { $(this).siblings(span.error).text(Not enough in stock); } else { $(this).siblings(span.error).text(); } }); }); however, it still allows the user to submit the form. How do I stop them from being able to submit the for if the quantity they ordered is over the limit? -- View this message in context: http://www.nabble.com/validating-dynamically-generated-data-tp17091060s27240p17111078.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] validating dynamically generated data
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 h4manual 1/h4 div class=qty title=9090/div input name=150 type=text id=150 class=order-qty /label for=150Qty:/label /div div class=instock h4manual 2/h4 div class=qty title=4848/div input name=151 type=text id=151 class=order-qty /label for=151Qty:/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-tp17091060s27240p17091060.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] toggle function on checkbox
I'm having a problem with toggle() and was hoping someone could help me. Using the toggle function on a checkbox seems to have disabled the checkbox's ability to check on and off. http://tinyurl.com/yo9onz http://tinyurl.com/yo9onz My code: $(document).ready(function(){ $(#precheck).toggle( function () { $(.preregbox).show('slow'); }, function () { $(.preregbox).hide('slow'); } ); }); -- View this message in context: http://www.nabble.com/toggle-function-on-checkbox-tp14695340s27240p14695340.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] checkbox and toggle function
Using toggle() with a checkbox disables the checkbox's ability to check itself on and off. http://tinyurl.com/yo9onz http://tinyurl.com/yo9onz -- View this message in context: http://www.nabble.com/checkbox-and-toggle-function-tp14695370s27240p14695370.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.