Forcing focus on a field is always a bad idea. Consider other means, like disabling fields.
Jörn On Tue, Oct 14, 2008 at 9:23 PM, TimW66 <[EMAIL PROTECTED]> wrote: > > Sorry to hijack a topic, but I too am writing some custom validation, > and I am running into a problem. I have a table form where after data > is entered in the first field on the row, a new blank row will be > added to the bottom of the table. I want to keep the user from > entering a duplicate value in that first column. I have the check for > duplicates working fine, but the focus always moves to the second > field in the row. Is there a way to force the user back to the first > field? > > On Oct 14, 9:12 am, Rick Faircloth <[EMAIL PROTECTED]> wrote: >> Good to know... and yes, Jorn's work is great and we appreciate his >> contributions to the community! >> >> Rick >> >> Kevin Scholl wrote: >> > Yeah, I have to speak very highly of Jorn's plugin. It's quite >> > comprehensive and very solid. When I started on mine (the first simple >> > version was about a year ago) I simply wanted to see what I could do >> > on my own, so I didn't use any of the existing plugins. But I don't >> > think you can go wrong with Jorn's work. >> >> > On Oct 14, 6:26 am, "Jörn Zaefferer" <[EMAIL PROTECTED]> >> > wrote: >> >> >> Yes it does. It even validates on keypress. Details about that are >> >> documented >> >> here:http://docs.jquery.com/Plugins/Validation/Reference#Validation_event >> >> >> Jörn >> >> >> On Tue, Oct 14, 2008 at 12:23 PM, Rick Faircloth >> >> >> <[EMAIL PROTECTED]> wrote: >> >> >>> Jorn, >> >> >>> Does your plug-in offer on-blur validation? >> >> >>> Rick >> >> >>> Jörn Zaefferer wrote: >> >> >>>> Have you looked at this validation plugin? >> >>>>http://bassistance.de/jquery-plugins/jquery-plugin-validation/ >> >> >>>> Jörn >> >> >>>> On Tue, Oct 14, 2008 at 5:16 AM, Nishan Karassik <[EMAIL PROTECTED]> >> >>>> wrote: >> >> >>>>> That is really slick. I like the check boxes after it validates. It >> >>>>> looks like you are very well versed in jQuery. This is my first >> >>>>> script, but I haven't had time to test it yet. It took me two days >> >>>>> (well evenings) to research the right strategy to get that far. I am >> >>>>> hoping to submit the form for server-side validation, this way I can >> >>>>> use this for any form validation, I just have to change the server >> >>>>> side validation response. From the server-side validation, I am >> >>>>> hoping to send a JSON array then dynamically update the corresponding >> >>>>> div with the key name to the key value. Will the following update the >> >>>>> div with the id name of variable err_id with the value contained by >> >>>>> err_message? $(err_id).val() = err_message; In the past I've wrote >> >>>>> my own JS like the following: >> >>>>> document.getElementById('err_provcode').innerHTML = err_provcode; >> >> >>>>> I also work in the Health Care industry on the billing side. I need >> >>>>> to do multiple validations combining different dependencies based on >> >>>>> database queries for Medical Coding Data Entry on the front-end. >> >> >>>>> Thanks, >> >>>>> Nishan >> >> >>>>> On Oct 13, 11:43 am, Kevin Scholl <[EMAIL PROTECTED]> wrote: >> >> >>>>>> I've done something similar to this, where validation is may be run at >> >>>>>> either field level or on form submit, or both (default is both, can be >> >>>>>> overridden by invocation setting, below). >> >> >>>>>>http://beta.ksscholl.com/jquery/formvalidate.html >> >> >>>>>> Routine is invoked by the following snippet in the HEAD of the >> >>>>>> document: >> >> >>>>>> $("#myFormSample").jqValidate({ >> >>>>>> // validateAt : "both", // "blur" | "submit" | "both" >> >>>>>> passMin : 6 >> >>>>>> }); >> >> >>>>>> The validation script itself is the bottom half of the following: >> >> >>>>>>http://beta.ksscholl.com/jquery/js/jqforms.js >> >> >>>>>> and checks that required fields have data, as well as various >> >>>>>> specialized fields have proper formatting and such. I'm quite sure >> >>>>>> that it could be cleaned up considerably by anyone more versed than >> >>>>>> myself in the intricacies of jQuery, but I'm pretty pleased thus far. >> >> >>>>>> Kevin >> >> >>>>>> On Oct 13, 10:45 am, Nishan Karassik <[EMAIL PROTECTED]> wrote: >> >> >>>>>>> Wouldn't the $("#my-form [EMAIL PROTECTED]'input']").blur(function() >> >>>>>>> { be >> >>>>>>> my trigger? >> >>>>>>> I would like to validate as the user tabs through the form. >> >>>>>>> How >> >>>>>>> would >> >>>>>>> I not run the function if the field just tabbed from is blank? >> >>>>>>> Thanks for your validation of my script. >> >>>>>>> Nishan >> >>>>>>> On Oct 13, 7:30 am, "Jörn Zaefferer" >> >>>>>>> <[EMAIL PROTECTED]> >> >>>>>>> wrote: >> >> >>>>>>>> Validation should always hook into the submit event, eg. >> >>>>>>>> $(#myform").submit(function() { ... }); >> >>>>>>>> That handles both clicking the submit button as well as hitting >> >>>>>>>> enter >> >>>>>>>> while an input field has focus. >> >>>>>>>> Apart from that, the form plugin handles submitting forms >> >>>>>>>> via >> >>>>>>>> ajax and >> >>>>>>>> handling the response quite well, including file >> >>>>>>>> uploads:http://malsup.com/jquery/form/ >> >>>>>>>> Jörn >> >>>>>>>> On Mon, Oct 13, 2008 at 5:57 AM, Nishan Karassik >> >>>>>>>> <[EMAIL PROTECTED]> wrote: >> >> >>>>>>>>> Hello, >> >>>>>>>>> I have never written a Jquery script, but have, over the >> >>>>>>>>> last few >> >>>>>>>>> days, compiled the following, but was hoping someone could look >> >>>>>>>>> over >> >>>>>>>>> this to see if I had problems. >> >>>>>>>>> $(document).ready(function () { >> >>>>>>>>> $("#my-form [EMAIL PROTECTED]'input']").blur(function() { >> >>>>>>>>> var queryString = $.("#my-form").formSerialize(); >> >>>>>>>>> $.post("/path/to/your/validation.php", queryString, >> >>>>>>>>> function(validation_errors) { >> >>>>>>>>> // do something like changing a css class, >> >>>>>>>>> disable submit... >> >>>>>>>>> $.each(validation_errors, function(err_id, >> >>>>>>>>> err_message) { >> >>>>>>>>> $(err_id).val() = err_message; >> >>>>>>>>> } >> >>>>>>>>> )}; >> >>>>>>>>> }); >> >>>>>>>>> )}); >> >>>>>>>>> Thanks, >> >>>>>>>>> Nishan >