[jQuery] Re: How to go to top of page after form validation fails (using jQuery validation plugin)
Hi folks, I found the answer: scroll(0,0); In my code, I put this line right after the code to generate the error message at the top of the page telling how many total errors there are. Hope this is helpful to someone. Kathryn On Mar 31, 6:05 pm, Kathryn wrote: > I'm using the validation plugin athttp://bassistance.de. When form > validation fails, focus goes to the first invalid element. But I have > a summary error message at the top of the page which I want the user > to see. If the first invalid field is too far down, they don't see the > message. How can I go to the top of the page after validation fails? > (Seems like this should be easy, but googling didn't reveal an > answer.) > > Thanks in advance-- > > Kathryn
[jQuery] Re: Trouble passing additional data with getJSON
Well, I solved the problem, but not by using getJSON. Here's the solution, in case it's helpful to anyone else. I found a page that lists a fourth undocumented (according to them--didn't have time to verify) parameter of $.post(), and that is the data type. http://thecodecentral.com/2007/11/20/the-missing-parameter-of-jquerypost I changed getJSON to post, specified the datatype as "json," changed request.querystring to request.form in the asp file, and it worked. I may never know why the other one didn't work, but thank goodness this one is working. Cheers, Kathryn On Apr 13, 4:14 pm, Kathryn wrote: > Hi all, > > I think I must be making an obvious mistake, but I can't see it. I'm > trying to pass additional data to the server with getJSON, but it's > not working. > > Here's my function: > > $(document).ready(function() { > $('#submit_uid').click(function() { > $.getJSON('pwreset_proc.asp',{check_type: 'verify_uid', uid: $ > ('#uid').val(), ajax: 'true'}, function(json){ > alert(json); > }); > }); > > }); > > Here's the form, with the button referenced in the click function: > > > ID: > > > > Here's the code in pwreset_proc.asp: > > dim check_type, uid > check_type = request.QueryString("check_type") > uid = request.QueryString("uid") > (this is followed by an SQL query that uses the passed data) > > When I click Submit, the form just fails quietly. > > To see if the problem was in the asp page, I hard coded the variables, > and the page works fine. So then I tried the asp code above followed > by > response.write(check_type) > response.end() > > and the page came up blank. So it appears that the data is not being > passed from the form to the asp page. > > The thing is, I have used a similar function on another page and it > works fine. The only difference is that it's attached to the change > event of a dropdown rather than the click event of a button. What am I > missing??? > > Thanks! > > Kathryn
[jQuery] Trouble passing additional data with getJSON
Hi all, I think I must be making an obvious mistake, but I can't see it. I'm trying to pass additional data to the server with getJSON, but it's not working. Here's my function: $(document).ready(function() { $('#submit_uid').click(function() { $.getJSON('pwreset_proc.asp',{check_type: 'verify_uid', uid: $ ('#uid').val(), ajax: 'true'}, function(json){ alert(json); }); }); }); Here's the form, with the button referenced in the click function: ID: Here's the code in pwreset_proc.asp: dim check_type, uid check_type = request.QueryString("check_type") uid = request.QueryString("uid") (this is followed by an SQL query that uses the passed data) When I click Submit, the form just fails quietly. To see if the problem was in the asp page, I hard coded the variables, and the page works fine. So then I tried the asp code above followed by response.write(check_type) response.end() and the page came up blank. So it appears that the data is not being passed from the form to the asp page. The thing is, I have used a similar function on another page and it works fine. The only difference is that it's attached to the change event of a dropdown rather than the click event of a button. What am I missing??? Thanks! Kathryn
[jQuery] How to go to top of page after form validation fails (using jQuery validation plugin)
I'm using the validation plugin at http://bassistance.de. When form validation fails, focus goes to the first invalid element. But I have a summary error message at the top of the page which I want the user to see. If the first invalid field is too far down, they don't see the message. How can I go to the top of the page after validation fails? (Seems like this should be easy, but googling didn't reveal an answer.) Thanks in advance-- Kathryn
[jQuery] Re: Form no longer works with upgrade to 1.3.2
John, Thanks for the tip. Validation did find some errors, but even after I fixed them it didn't work. But by trial and error (after getting some sleep! :) ) I discovered the offending jQuery line. With the upgrade, I had the wrong syntax for the name attribute. In trying to fix it, I found some funky answer on the web last night which apparently caused the problem. But this morning I found the right answer (i.e., $("input[name='dept']").click (function() { etc etc...) and the problem's solved. Thanks again for your time. I don't know if you get tired of hearing it (hopefully not!) but jQuery ROCKS! I'm just learning it, but it has simplified my coding and put wonderful enhancements within easy reach. THANK YOU!!! Kathryn On Mar 30, 10:16 pm, John Resig wrote: > Well, without being able to see the form in question - does your page > validate? If everything is going into a single input that sounds like > a problem with malformed HTML markup. > > --John > > 2009/3/30 Kathryn : > > > > > I'm working on a web form and had to upgrade to 1.3.2 tonight to solve > > some problems. Unfortunately, I now have a much worse problem. Not by > > my choice, I have to use ASP. With the lower version of jQuery, the > > form was working fine and I could process it as usual...e.g., > > > HTML: > > > > > > etc. (There are around 40 fields on this form) > > > ASP: > > dim dept, employee > > dept = request.form("dept") > > employee = request.form("employee") > > etc. > > > However, since upgrading, when I submit the form and response.write > > the results on the ASP page, the contents of ALL form fields are > > contained in the dept variable and all the other variables are empty. > > I know it's not a problem with the ASP code, because it was working > > immediately before the upgrade and I haven't changed it. > > > Has anyone else had this happen, and if so, what did you do about it? > > > Thanks in advance, > > > Kathryn
[jQuery] Form no longer works with upgrade to 1.3.2
I'm working on a web form and had to upgrade to 1.3.2 tonight to solve some problems. Unfortunately, I now have a much worse problem. Not by my choice, I have to use ASP. With the lower version of jQuery, the form was working fine and I could process it as usual...e.g., HTML: etc. (There are around 40 fields on this form) ASP: dim dept, employee dept = request.form("dept") employee = request.form("employee") etc. However, since upgrading, when I submit the form and response.write the results on the ASP page, the contents of ALL form fields are contained in the dept variable and all the other variables are empty. I know it's not a problem with the ASP code, because it was working immediately before the upgrade and I haven't changed it. Has anyone else had this happen, and if so, what did you do about it? Thanks in advance, Kathryn
[jQuery] Re: Need help validating a dropdown list
Jörn, Many thanks for the clarification and tip. When I removed the value attribute completely, it didn't work, but when I left it in with no value, the error message came up as expected. The code below works. Thanks again-- Kathryn --Select One-- Feb 16 - 20, 2009 Mar 16 - 20, 2009 Apr 13 - 17, 2009 May 11 - 15, 2009 On Feb 1, 4:54 am, Jörn Zaefferer wrote: > Dropdowns are supported just fine. Just remove the value attribute > from the "select one" option and add a required rule for the field. > See > alsohttp://jquery.bassistance.de/validate/demo/radio-checkbox-select-demo... > > Jörn > > On Sat, Jan 31, 2009 at 7:59 PM, Kathryn wrote: > > > Hi all, > > > I'm using the fantastic validation plugin (from bassistance.de) and > > have run into a little glitch. I understand the plugin doesn't > > currently handle dropdowns, but I found a possible solution on True > > Tribe (http://www.thetruetribe.com/jquery/1-jquery-api/68-jquery- > > plugin-validation-with-ajax). I can't get it to work, though. I'm > > pretty new to jQuery and am probably making an obvious error I can't > > see. Here's my jQuery code: > > > $(document).ready(function(){ > > $("#reg_form").validate({ > > > onfocusout: false, > > onkeyup: false, > > onclick: false, > > > rules: { > > gender: {required:true}, > > spouse_attend: {required:true} > > } > > > }); > > > $validator.addMethod( > > "select_class", > > function(value, element) { > > return this.optional(element) || ( value.indexOf("--Select One--") == > > -1); > > }, > > "Please select a class."); > > > }); > > > And here's the dropdown I'm trying to validate. > > > > > --Select One-- > > Feb 16 - 20, 2009 > > Mar 16 - 20, 2009 > > Apr 13 - 17, 2009 > > May 11 - 15, 2009 > > > > > What am I doing wrong? Or is there another way to do this? > > > Thanks in advance! > > > Kathryn
[jQuery] Need help validating a dropdown list
Hi all, I'm using the fantastic validation plugin (from bassistance.de) and have run into a little glitch. I understand the plugin doesn't currently handle dropdowns, but I found a possible solution on True Tribe (http://www.thetruetribe.com/jquery/1-jquery-api/68-jquery- plugin-validation-with-ajax). I can't get it to work, though. I'm pretty new to jQuery and am probably making an obvious error I can't see. Here's my jQuery code: $(document).ready(function(){ $("#reg_form").validate({ onfocusout: false, onkeyup: false, onclick: false, rules: { gender: {required:true}, spouse_attend: {required:true} } }); $validator.addMethod( "select_class", function(value, element) { return this.optional(element) || ( value.indexOf("--Select One--") == -1); }, "Please select a class."); }); And here's the dropdown I'm trying to validate. --Select One-- Feb 16 - 20, 2009 Mar 16 - 20, 2009 Apr 13 - 17, 2009 May 11 - 15, 2009 What am I doing wrong? Or is there another way to do this? Thanks in advance! Kathryn