[jQuery] [validate] form is sending despite the fact the form is not complete
Just like the subject says, my form is sending despite the fact that the form is not complete. The same happens if there are errors in the form. I've attached the JS and the HTML. Any help is greatly appreciated. I'm testing it locally right now. $(#reserve).validate({ rules: { firstname: { lettersonly: true, required: true }, last: { lettersonly: true, required: true }, address: { required: true }, city: { lettersonly: true, required: true }, state: { required: true, drop: true, required: true }, zip: { zipcode: true, required: true }, numfirst: { digits: true, required: true }, numsecond: { digits: true, required: true }, numthird: { digits: true, required: true }, tickets: { drop: true, required: true }, email: { email: true, required: true } }, messages: { firstname: Please enter a valid first name, last: Please enter a valid last name, address: Please enter a valid address, city: Please enter a valid city, state: Please enter a valid state, zip: Please enter a valid zip code, numfirst: Please enter the first three numbers of your phone number, numsecond: Please enter the second three numbers of your phone number, numthird: Please enter the first last four of your phone number, tickets: Please enter a number of tickets you would like, email: Please enter a valid email address }, errorPlacement: function(error, element){ if(element.attr('name') == 'email') { error.insertAfter($('input[name=email]')); $('br /').insertBefore('label.error'); } else if(element.attr('name') == 'numfirst') { error.insertAfter($('input[name=numthird]')); $('br /').insertAfter($('input[name=numthird]')); } else if(element.attr('name') == 'numsecond') { error.insertAfter($('input[name=numthird]')); $('br /').insertAfter($('input[name=numthird]')); } else { error.insertAfter(element); $('br /').insertAfter(element); } } }); form id=reserve method=post action=http://localhost/agraboats/ form.php First Name: input type=textvalue= name=firstname id=firstname /br / Last Name: input type=textvalue= name=last id=last /br / Address: input type=textvalue= name=address id=address / br / City: input type=textvalue= name=city id=city /br / select name=state size=1 id=state option value=ALAlabama/optionoption value=AKAlaska/ optionoption value=AZArizona/optionoption value=ARArkansas/ optionoption value=CACalifornia/optionoption value=COColorado/optionoption value=CTConnecticut/ optionoption value=DEDelaware/optionoption value=DCDist of Columbia/optionoption value=FLFlorida/optionoption value=GAGeorgia/optionoption value=HIHawaii/optionoption value=IDIdaho/optionoption value=ILIllinois/optionoption value=INIndiana/optionoption value=IAIowa/optionoption value=KSKansas/optionoption value=KYKentucky/optionoption
[jQuery] [validate] Errors are not clearing in my Validate jQuery
Here's the code. $(#createEvent).validate({ rules: { title: { lettersonly: true, required: true } }, messages: { title: Enter a valid title! }, errorPlacement: function(error, element){ error.insertAfter(element); $('br /').insertAfter(element); } }); The id of the field is id=title, of course. Two thing, however. The errors never clear out, even if the parameters are true. I used the same format for another site, and it worked properly, so I copied the code and changed what I needed to change. It still never works. I have the same form for editing things, with the same names and everything, but with that form, the Validation doesn't work at all. It doesn't even give me errors when it should. Please.Help.Thankyou.
[jQuery] [validate] Errors are not clearing in my Validate jQuery code.
Here's the code. $(#createEvent).validate({ rules: { title: { lettersonly: true, required: true } }, messages: { title: Enter a valid title! }, errorPlacement: function(error, element){ error.insertAfter(element); $('br /').insertAfter(element); } }); The id of the field is id=title, of course. Two thing, however. The errors never clear out, even if the parameters are true. I used the same format for another site, and it worked properly, so I copied the code and changed what I needed to change. It still never works. I have the same form for editing things, with the same names and everything, but with that form, the Validation doesn't work at all. It doesn't even give me errors when it should. Please.Help.Thankyou.
[jQuery] jQuery Form Plugin - success callback function isn't called
Hey guys, I'm working with the jQuery Form Plugin and I'm having some trouble with it. In my HTML I have a button, which, when clicked, inserts a form via jQuery. To then register the form's submit event, I use the livequery plugin in my (document).ready function: (document).ready(function($) { var options = { target: '#editable_content', // target element(s) to be updated with server response success: function(responseText, statusText) { alert(responseText); }, // post-submit callback }; $('.edit_contact').livequery('submit', function() { $(this).ajaxSubmit(options); return false; }); }); The form submits as it should, using an AJAX call. When I add a beforeSubmit callback function to the options array, that gets called as well, as it should. Only the success callback (the alert) isn't called and I don't know why. Can anyone help??? Regards, Sebastian
[jQuery] Inconsistent behaviour of [autocomplete]
Hello, the plugin http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/ has a slight inconsistency. With multiple not set (default=false), I have different behaviour if I select a value with 'Enter' or with a mouse click. The return executes a $input.blur() the mouse click not. I would appreciate if the blur is removed to have the cursor rest in the input field. The user can then press 'tab' to get into the next field instead of being forced to click in the next field. Best Regards Sebastian ... snip ... case KEY.RETURN: if( selectCurrent() ){ // make sure to blur off the current field if( !options.multiple ) $input.blur(); event.preventDefault(); } break;
[jQuery] Re: [validate] validation doesn't work for radio buttons associated with hidden field
Hi, to solve my problem I had to change the idorName function in jquery.validate: idOrName: function(element) { if (element.type != hidden) { return this.checkable(element) ? element.name : element.id || element.name; } if($(input[name='+element.name+'][type='radio']).length 0){ return element.name; } }, and created a new method in additonal-methods: jQuery.validator.addMethod(chosen, function(value, element) { if(value != ){ return true; } if($(input[name='+element.name+']:checked).length 0){ return true; } return false; }, Select an option); I thought this might help someone, and possibliy be added to a new release of the jquery.validate. Sebastian On Apr 22, 1:31 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: sebastian schrieb: Hi, the problem i have is that I have a group of radio buttons associated with a hidden field like this: input type=hidden name=data[User][gender] value= id=UserGender_ / input type=radio name=data[User][gender] id=UserGenderF value=f / label for=UserGenderFFemale/label input type=radio name=data[User][gender] id=UserGenderM value=m / label for=UserGenderMMale/label and I have the following validation rule for the element: data[User][gender]:required the validation doesn't work , it always shows an error whether the radio buttons are selected or not. Please help. The required-method doesn't support mixed types. In your setup, only the hidden field is validated, which is always invalid. You could implement a custom required-method for this case. Take a look at the current required-implementation for reference validating the group of radio buttons. Jörn
[jQuery] Re: [validate] value is trimmed before getting to validation function
Thank you very much!!! On Apr 22, 1:27 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: sebastian schrieb: Hi, i'm developing a costum validation method for a password field, the password must not contain spaces. I thought my method worked fine until during a test i put a space at the end of the password, my method returned that the password was correct, and i noticed that the problem was that the value of the field is trimmed before it is sent to the validation method. And I thought it might be a good idea not to trim the values before they are sent to the validation methods, what do you think? Instead of using the trimmed value in your method, use the second argument, which points to the element itself, and get the value from there, via element.value Jörn
[jQuery] Re: [validate] validation doesn't work for radio buttons associated with hidden field
Thank you very much for your answer!!! On Apr 22, 1:31 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote: sebastian schrieb: Hi, the problem i have is that I have a group of radio buttons associated with a hidden field like this: input type=hidden name=data[User][gender] value= id=UserGender_ / input type=radio name=data[User][gender] id=UserGenderF value=f / label for=UserGenderFFemale/label input type=radio name=data[User][gender] id=UserGenderM value=m / label for=UserGenderMMale/label and I have the following validation rule for the element: data[User][gender]:required the validation doesn't work , it always shows an error whether the radio buttons are selected or not. Please help. The required-method doesn't support mixed types. In your setup, only the hidden field is validated, which is always invalid. You could implement a custom required-method for this case. Take a look at the current required-implementation for reference validating the group of radio buttons. Jörn
[jQuery] [validate] validation doesn't work for radio buttons associated with hidden field
Hi, the problem i have is that I have a group of radio buttons associated with a hidden field like this: input type=hidden name=data[User][gender] value= id=UserGender_ / input type=radio name=data[User][gender] id=UserGenderF value=f / label for=UserGenderFFemale/label input type=radio name=data[User][gender] id=UserGenderM value=m / label for=UserGenderMMale/label and I have the following validation rule for the element: data[User][gender]:required the validation doesn't work , it always shows an error whether the radio buttons are selected or not. Please help.
[jQuery] How can I access methods of an applet element using jQuery?
Hi all, I have some problem using methods of an applet element when I use jQuery syntax. How can I solve this problem? Please refer to the following source code: APPLET id=ch01 archive=classes.jar,jfreechart-1.0.9.jar,jcommon-1.0.12.jar,json.jar,netscape.jar code=sooo.AppletXYLine /APPLET script type=text/javascript src=js/jquery/jquery.js/script script type=text/javascript // addValues() is a method defined in AppletXYLine.class returnValue = document.getElementById(ch01).addValues(strValue); // this works well returnValue = $(#ch01).addValues(strValue); // doesn't work /script Thanks, Philip
[jQuery] Interface sortable: Limit of elements which can be dragged into a droppable
Hi, Please have a look at my sample at http://hosting-saar.de/jquerytest/index.html The situation is: I have 2 sortables, one is the pool which contains all available icons the other should be an ui where you can place icons from the pool. The problem is: There are more icons in the pool than place for icons in the ui. So is there a way to prevent icons to be dropped into the ui when its already full? Regards, Sebastian