[jQuery] Re: jQuery 1.2.6 clone problem with internet explorer.
This clone() works for me in ie 6.0 :). May be C.fx.step is an element in your page and IE 6 can't find it for some reason? head script src=../scripts/jquery-1.3.2.js type=text/javascript/ script script type=text/javascript $(document).ready(function() { $(#btnCloneIt).click(function() { $(#container).append($(#toBeCloned).clone()); }); }); /script /head body div id=container div id=toBeClonedI am a clone/div /div input type=button value=Clone It id=btnCloneIt name=btnCloneIt / /body On Jan 14, 4:51 am, m.ugues m.ug...@gmail.com wrote: Hallo all. When i call the clone() function in Internet Explorer jQuery meltdowns :( The error reported in ie6 is: C.fx.step is null or not an object. Any idea how to fix the problem? Kind regards Massimo
[jQuery] Re: jQuery 1.2.6 clone problem with internet explorer.
Sorry, I just noticed you are using 1.2.6. Ignore my reply. On Jan 14, 11:26 am, Jules jwira...@gmail.com wrote: This clone() works for me in ie 6.0 :). May be C.fx.step is an element in your page and IE 6 can't find it for some reason? head script src=../scripts/jquery-1.3.2.js type=text/javascript/ script script type=text/javascript $(document).ready(function() { $(#btnCloneIt).click(function() { $(#container).append($(#toBeCloned).clone()); }); }); /script /head body div id=container div id=toBeClonedI am a clone/div /div input type=button value=Clone It id=btnCloneIt name=btnCloneIt / /body On Jan 14, 4:51 am, m.ugues m.ug...@gmail.com wrote: Hallo all. When i call the clone() function in Internet Explorer jQuery meltdowns :( The error reported in ie6 is: C.fx.step is null or not an object. Any idea how to fix the problem? Kind regards Massimo
[jQuery] Re: Need help with a required field from radio selection
$(form).validate( { rules: { legal_status_comment: { required: function(element) { return $ ([name=legal_status]:checked).attr(id) == other_radio; } } } }); On Jan 12, 3:43 am, jeffself jeff.s...@gmail.com wrote: I've got a form with a radio group called 'legal_status'. There are five radio buttons. The last one has an id='other_radio'. If this button is selected, I have a textarea field that gets displayed. The field has an id='legal_status_comment'. This textarea field is wrapped by a div with an id='other_text_area' that is hidden until the other_radio button is selected. How do I write the rule to make the 'legal_status_comment' field to be required if the 'other_radio' button has been selected? Thanks!
[jQuery] Re: Filter xml data before display
Use .ajax to get filtered the data on the server, instead of retrieving all xml data and filtering the data on the client. On Jan 12, 9:06 am, stevo ayi...@gmail.com wrote: Hi all, I have an xml file that is dynamically generated at periodic intervals onto disk. the information contained in this file is displayed in a vertical scroller and this works fine. I however need to filter the data based on the logged-in users preferences. These preferences are stored in a database and retrieved after the user logs in. Only data in the xml file that match the user's preferences must be displayed. Thanks in advance.
[jQuery] Re: Go through XML nodes only 1 level deep
As suggested by Steven, set the ContentType to text/xml. I don't know how to do it in php, but here is the snipped from data source in c# . StringBuilder sb = new StringBuilder(); sb.Append(?xml version=\1.0\ encoding=\UTF-8\?); sb.Append(Response); sb.Append(Ip74.125.45.100/Ip); sb.Append(StatusOK/Status); sb.Append(CountryCodeUS/CountryCode); sb.Append(CountryNameUnited States/CountryName); sb.Append(RegionCode06/RegionCode); sb.Append(RegionNameCalifornia/RegionName); sb.Append(CityMountain View/City); sb.Append(ZipPostalCode94043/ZipPostalCode); sb.Append(Latitude37.4192/Latitude); sb.Append(Longitude-122.057/Longitude); sb.Append(Timezone-8/Timezone); sb.Append(Gmtoffset-8/Gmtoffset); sb.Append(Dstoffset-7/Dstoffset); sb.Append(/Response); Response.Clear(); Response.ContentType = text/xml; Response.Write(sb.ToString()); Response.End(); On Jan 8, 2:42 am, Frank Peterson fictionalper...@gmail.com wrote: That works in IE8, but in FF 3.5.3 I get undefined in the alertbox. I've disabled adblock and flashblock, so its not those interfering. I dont get anything in the error console either. The code I had posted earlier doesn't work in FF 3.53 either. I'm accessing it by running it on my desktop with this as the URL file:///c:/xampplite/htdocs/DEVELOPMENT/geolocate.htm but even when I access it via a decent URL I still get undefined in FFhttp://localhost/DEVELOPMENT/geolocate.htm On Jan 6, 10:13 pm, Jules jwira...@gmail.com wrote: Ahah, too much stale eggnog. var option = { error: function(request, status, error) { alert(error); }, success: function(data, status) { var xml = $(data); alert(xml.find('City').text()); }, dataType: xml, type: GET, url: your url here }; $.ajax(option); This code works for me. On Jan 7, 2:50 pm, Steven Yang kenshin...@gmail.com wrote: just making sure you are not able to parse the xml at all right? i believe for IE you have to make sure you server returns the correct content type like text/xml to client inorder for you to parse hope this help On Thu, Jan 7, 2010 at 9:30 AM, Jules jwira...@gmail.com wrote: For some reason, it works on firefox (3.5.6) and doesn't work in ie 6.0 and 8.0 On Jan 7, 6:39 am, Frank Peterson fictionalper...@gmail.com wrote: I'm grabbing an XML file with jQuery like this: $(document).ready(function(){ $.ajax({ type: GET, url: http://ipinfodb.com/ip_query.php?ip=74.125.45.100;, dataType: xml, success: function(xml) { //$(xml).find().each(function(){ var city = $(xml).find(City).text(); /* $('div class=items id=link_'+id+'/div').html ('a href='+url+''+title+'/a').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('div class=brief/div').html(brief).appendTo ('#link_'+id); $('div class=long/div').html(long).appendTo ('#link_'+id); }); */ alert(city) //}); } }); }); The XML file looks like this ?xml version=1.0 encoding=UTF-8? Response Ip74.125.45.100/Ip StatusOK/Status CountryCodeUS/CountryCode CountryNameUnited States/CountryName RegionCode06/RegionCode RegionNameCalifornia/RegionName CityMountain View/City ZipPostalCode94043/ZipPostalCode Latitude37.4192/Latitude Longitude-122.057/Longitude Timezone-8/Timezone Gmtoffset-8/Gmtoffset Dstoffset-7/Dstoffset /Response But I can't get it to pull the data out.
[jQuery] Re: Go through XML nodes only 1 level deep
For some reason, it works on firefox (3.5.6) and doesn't work in ie 6.0 and 8.0 On Jan 7, 6:39 am, Frank Peterson fictionalper...@gmail.com wrote: I'm grabbing an XML file with jQuery like this: $(document).ready(function(){ $.ajax({ type: GET, url: http://ipinfodb.com/ip_query.php?ip=74.125.45.100;, dataType: xml, success: function(xml) { //$(xml).find().each(function(){ var city = $(xml).find(City).text(); /* $('div class=items id=link_'+id+'/div').html ('a href='+url+''+title+'/a').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('div class=brief/div').html(brief).appendTo ('#link_'+id); $('div class=long/div').html(long).appendTo ('#link_'+id); }); */ alert(city) //}); } }); }); The XML file looks like this ?xml version=1.0 encoding=UTF-8? Response Ip74.125.45.100/Ip StatusOK/Status CountryCodeUS/CountryCode CountryNameUnited States/CountryName RegionCode06/RegionCode RegionNameCalifornia/RegionName CityMountain View/City ZipPostalCode94043/ZipPostalCode Latitude37.4192/Latitude Longitude-122.057/Longitude Timezone-8/Timezone Gmtoffset-8/Gmtoffset Dstoffset-7/Dstoffset /Response But I can't get it to pull the data out.
[jQuery] Re: Go through XML nodes only 1 level deep
Ahah, too much stale eggnog. var option = { error: function(request, status, error) { alert(error); }, success: function(data, status) { var xml = $(data); alert(xml.find('City').text()); }, dataType: xml, type: GET, url: your url here }; $.ajax(option); This code works for me. On Jan 7, 2:50 pm, Steven Yang kenshin...@gmail.com wrote: just making sure you are not able to parse the xml at all right? i believe for IE you have to make sure you server returns the correct content type like text/xml to client inorder for you to parse hope this help On Thu, Jan 7, 2010 at 9:30 AM, Jules jwira...@gmail.com wrote: For some reason, it works on firefox (3.5.6) and doesn't work in ie 6.0 and 8.0 On Jan 7, 6:39 am, Frank Peterson fictionalper...@gmail.com wrote: I'm grabbing an XML file with jQuery like this: $(document).ready(function(){ $.ajax({ type: GET, url: http://ipinfodb.com/ip_query.php?ip=74.125.45.100;, dataType: xml, success: function(xml) { //$(xml).find().each(function(){ var city = $(xml).find(City).text(); /* $('div class=items id=link_'+id+'/div').html ('a href='+url+''+title+'/a').appendTo('#page-wrap'); $(this).find('desc').each(function(){ var brief = $(this).find('brief').text(); var long = $(this).find('long').text(); $('div class=brief/div').html(brief).appendTo ('#link_'+id); $('div class=long/div').html(long).appendTo ('#link_'+id); }); */ alert(city) //}); } }); }); The XML file looks like this ?xml version=1.0 encoding=UTF-8? Response Ip74.125.45.100/Ip StatusOK/Status CountryCodeUS/CountryCode CountryNameUnited States/CountryName RegionCode06/RegionCode RegionNameCalifornia/RegionName CityMountain View/City ZipPostalCode94043/ZipPostalCode Latitude37.4192/Latitude Longitude-122.057/Longitude Timezone-8/Timezone Gmtoffset-8/Gmtoffset Dstoffset-7/Dstoffset /Response But I can't get it to pull the data out.
[jQuery] Re: remote validation on empty field
May be a dumb suggestion, but can't you set the value as empty when there is no value? On Dec 6, 7:53 pm, david michaelg...@gmail.com wrote: Hi all, I want to make a remote validation on an empty field. Sometimes the field may be empty and sometimes not. This depends on the selection of other elements. I send them with the data hash of the remote method. The response should be written next to the empty field. As i understand, by default an empty field is not validated(this is a feature), but how may i force the plugin to make it ? Thanks, David
[jQuery] Re: remote validation on empty field
Sorry forgot the code: $(#field).rules(add, { remote: { url:test.asp, type: post, data: {fieldvalue: function(){ if ($(#field).val() == ) return empty; else return $(#field).val(); } } } }); On Dec 7, 9:15 am, Jules jwira...@gmail.com wrote: May be a dumb suggestion, but can't you set the value as empty when there is no value? On Dec 6, 7:53 pm, david michaelg...@gmail.com wrote: Hi all, I want to make a remote validation on an empty field. Sometimes the field may be empty and sometimes not. This depends on the selection of other elements. I send them with the data hash of the remote method. The response should be written next to the empty field. As i understand, by default an empty field is not validated(this is a feature), but how may i force the plugin to make it ? Thanks, David
[jQuery] Re: Newbie validator question/problem
Can't you use remote validation? This code should work. $(#password).rules(add, { messages: { remote: Invalid password. }, required: true, remote: { url: .../UVServer/login.php, type: get, data: { email: function() { return $(#email).val(); }, password: function() { return hex_md5($('#password').val()); } } } }); On Nov 15, 1:45 pm, sprach bensprach...@gmail.com wrote: I am new to javascript, jquery and validator, but really see the potential and am trying to use in a new application. I am having a little trouble wrapping my head around the layers of callbacks. I have a simple login form that I want to validate, but want to send an md5 encrypted password to the server. All of my validation works until I try and submit the form. Here is the code snippet of the validator submit handler: submitHandler: function(form) { var pwd = $('#password').val(); // md5 encode the password md5pwd = hex_md5(pwd); //$('#password').val(pwd); $.get('../UVServer/login.php','email='+$ ('#email').val()+ 'password='+ md5pwd, function(resp) { if (resp == 'false') { // password didn't match validator.showErrors({password: Incorrect Password or Email Address!}); return false; } form.submit(); // Password matched, submit the form }) }, ... The problem that I run into is that I cannot call form.submit() in the anonymous call back that I use for the jquery $.get call. In the code above, firebug claims that form.submit() is not a function. I have tried many work arounds but nothing seems to work. I don't want to use the remote rule, because I don't want to pass the unencrypted password to the server. Help greatly appreciated.
[jQuery] Re: Validation plugin rules() ???
http://docs.jquery.com/Plugins/Validation/Methods Also, I found it was worth while to look into jquery.validation.js code. On Nov 17, 8:55 am, Atkinson, Sarah sarah.atkin...@cookmedical.com wrote: Is there a list somewhere of what the options are for the rules (required, email) I can't seem to find more info on this in the jquery site.
[jQuery] Re: Attribute filters doesn't work with similar values
Put a space after me or alternatively, use a delimiter if it is possible. -- HTML a href=site rel=me me /a a href=site rel=met met /a -- Code xfn_me = $(a[rel*='me ']).length; or xfn_me = $(a[rel*='me.']).length; On Nov 17, 6:57 am, UVL andrea.do...@gmail.com wrote: I'm trying to filter the XFN relationships meta data. If you don't know, it works like this: a href=site rel=friend colleague Name /a in REL you can have various values, like friend, collegue but even me and met because you can have multiple values, I did this: xfn_me = $(a[rel*=me]).length; but this doesn't work, because both me and met are matched! Is there a way to filter the values exactly, even when there are multiple values?
[jQuery] Re: Count items inside/outside of visible area
This code should works as it retrieves the parent height during run- time $(document).ready(function() { var cnt1 = $(#test_list).parent().css(height); var cnt2 = $(#test_list).children(:first).css (height); var re = /px/g; alert(parseFloat(cnt1.replace(re, )) / parseFloat (cnt2.replace(re, ))); //five $(#test_list).parent().css(height, 120px); cnt1 = $(#test_list).parent().css(height); alert(parseFloat(cnt1.replace(re, )) / parseFloat (cnt2.replace(re, ))); // six }); On Nov 15, 1:35 am, gravyfries chuckco...@gmail.com wrote: Any idea how to make this work? In the following example I need to know how many items fall inside/outside of the visible area. This can't be based on the height of the parent div because that will be variable eventually: html head title/title script type=text/javascript src=jquery-1.3.2.js/script script type=text/javascript $(document).ready(function(){ var cnt = $('#test_list li:visible').size(); alert(cnt); }); /script style ul, li {padding: 0; margin: 0;} li {height: 20px;} /style /head body div style=height: 100px; overflow: hidden; ul id=test_list liTest/li liTest/li liTest/li liTest/li liTest/li liTest/li liTest/li liTest/li liTest/li liTest/li liTest/li liTest/li /ul /div /body /html
[jQuery] Re: (validate plugin) dependency callback not being triggered
Hi, Validation only triggered if you call submit the page or call the $ (form).valid() function. I didn't see any submit() or $ (form).valid() call in your page. Try adding this to your page js script inside ready() $(#validateMe).click(function(){ if($(form).valid()) alert(All data are valid); else alert(Invalid data); }); html input type=button id=validateMe name=validateMe value=Validate / Hope this help. BTW: you misspelled territory in ACT :) On Nov 6, 12:06 pm, Brad Hile brad.h...@gmail.com wrote: Bump Hi I've tried every way I can think of to use dependency to enable additional elements to be required and have had no luck at all. I simply want to enable required on a number of fields when a specific radio button is selected and for it to be disabled when its not. (These fields are hidden when the radio button is deselected) I've tested the response from the functions and it appears correct but after hours of staring at this I just can't figure it out. Help.. please? original code is onhttp://promotionalpenshop.com.au/testorder.php?p=4 though I may have changed it by the time you look at this. So basically I've tried an inline function something like: organisation:{required: function(element) { return $(.payment_type:checked).val() == 'invoice'); } } - - - - - - - - - - - - - - Setting a var to true/false when the radio button is clicked and testing that: var invoice; $(.payment_type).change(function () { if($(this).val() != 'paypal'){ $(#paybyinvoicefields).slideDown('slow'); invoice = true; } else { $(#paybyinvoicefields).slideUp('slow'); invoice = false; } organisation:{required: invoice} - - - - - - - - - - - - - - Using an enternal function organisation:{required: invoiceme() } function invoiceme() { return ($(.payment_type:checked).val() == 'invoice')? true : false; }
[jQuery] Re: Submitting after Validation
Hi Stephen, Try using input type=button instead of submit as per my example below. Excuse the aspx :). register.aspx code. string usrName = Request[userName]; Response.Clear(); Response.Write(Hello + usrName); Response.End(); -- client side code and html script type=text/javascript $(document).ready(function() { $(form).validate(); $(#userName).rules(add, { required: true, messages: { required: User Name is required. } }); $(#submitForm).click(function() { if ($(form).valid()) { $.post(register.aspx, $(form).serialize(), function (data, status) { $(#message).text(data) }, text) } }); }); /script body div id=message/div form id=dataForm table tr tdlabelUser Name:/label/td tdinput type=text id=userName name=userName value=//td /tr tr td colspan=2input type=button id=submitForm name=submitForm value=Submit //td /tr /table /form /body --- end of client side code and html On Nov 5, 7:41 am, StephenJacob turnstylecreat...@gmail.com wrote: Just to clarify, the $.post function works perfectly and returns my json results. Due to the limitations of the validation system i was using (no remote options) i had to begin using the standard jquery .validate library. Please help me understand how to implement the .Validate w/ my HTML form. As you can see the $.post option has the process.php written in the Jquery and leaves the HTML form action blank. With the Jquery .Validate, I need to define the process.php as the Action correct? If so, why does the form continue to submit normally? Thanks for all the help everyone! I think with a bit more guidance i'll have a really strong understanding of the validation system. On Nov 4, 3:33 pm, StephenJacob turnstylecreat...@gmail.com wrote: @Leonard, unfortunately it's not due to the function argument. @Dylan, I've looked at this tutorial a few times. It's not using the official Jquery Validate system and hasn't been able to help me fill in any gaps in my learning curve... It seems that every tutorial has their own convoluted system to doing validation.. And the ones that do use the standard validation system none of them thoroughly explain the form submission part. This is my current working Validation code + Submit function that does not work properly. It post the page normally, like any HTML form would. $(document).ready(function(){ $(#contactForm).validate({ rules: { fullname: { required: true, minlength: 2 }, email: { required: true, email: true }, company: { required: true, minlength: 2 }, phone: { required: true, minlength: 2 }, }, messages: { fullname: 'span class=errorPlease enter your bfull name/b./ span', email: 'span class=errorPlease enter a valid bemail address/ b./span', company: 'span class=errorPlease enter your bcompany/b./ span', phone: 'span class=errorPlease enter your bphone number/b./ span' }, submitHandler: function() { form.submit(); } }); }); // HTML FORM form id=contactForm method=POST action=process.php //Stuff goes here /form // WORKING VALIDATION USING LIMITED VALIDATION SYSTEM $(document).ready(function(){ $(#signupForm #submit).click(function(){ $(.error).hide(); var hasError = false; var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; var regarding_Val = $(#regarding).val(); var message_Val = $(#message).val(); var subcontact = $(#subcontact).val(); var fullname_Val = $(#fullname).val(); if(fullname_Val == '') { $(#fullname).after('span class=errorPlease enter your full name./span'); hasError = true; } var company_Val = $(#company).val(); if(company_Val == '') { $(#company).after('span class=errorPlease enter your company./span'); hasError = true; } var phone_Val =
[jQuery] Re: (validate) validator is undefined error
Sorry, didn't read the question thoroughly, whyvisitother: { required: function(element) { var result = false; var chk = $([name=whyvisit]); $([name=whyvisit]:checked).each(function () { if (chk.index($(this)) == 4) result = true; }); return result; } } On Oct 30, 12:14 am, Collectonian collecton...@gmail.com wrote: Thanks, but that only seems to work if they only pick other. Since they can pick multiple checkboxes from that set, I need to see if they picked it among possibly multiple others. On Oct 28, 5:50 pm, Jules jwira...@gmail.com wrote: Use this rule. whyvisitother: { required: function(element) { return $([name=whyvisit]).index($ ([name=whyvisit]:checked)) == 4; }
[jQuery] Re: Simple problem
Modify this line of code var panelID = panel_ + $(input).val(); to var panelID = panel_ + $(this).val(); On Oct 30, 9:56 am, AlChuck alan.oeh...@alanoehler.com wrote: Hello, I'm new to using jQuery. I was motivated by wanting to put some panels on an ASP.NET website which would display additional info if a link or button was clicked. I found a simple tutorial and mimicked that and it works fine, but uses the specific ID of the hyperlink to trigger the action. My page needs a list of items, and if you click on one, extra information appears right below the item. So what I want to do is capture clicks on any link, read the ID, and then use the ID to identify the ID of the related asp:Panel element. Here's the starting point: script type=text/javascript $(function() { $(#myButtonID).click(function(evt) { evt.preventDefault(); $('#myPanelID').toggle('fast'); }); }); /script If you click on the button rendered thusly: input id=myButtonID type=button value=Hide/Show / The panel with id=myPanelID is toggled (the CSS defines it so that display is set to none by default. But I want a list of these panels and buttons on my page, so I want the code to be able to do this for any of the buttons I click. It also works if instead of the button with the specific ID myButtonID I change $(#myButtonID).click(function(evt) to $(input).click(function(evt) My impression is that this will cause the code to trigger if any input element on the page is clicked, which is the first step to what I want to do. My notion is that I can then get the value of the clicked button and use that value to identify which panel to animate. One of the FAQs on the jQuery site says I can get the value of the button thusly: var mybuttonval = $(input).val(); Then I could use a simple naming convention and use that value to identify the Panel I want to animate. For example, if my button had the value ACME_widget-mach1 I could set the Panel I want to show text in to panel_ACME_Widget-mach1 So I rewrote my code as follows: script type=text/javascript $(function() { $(input).click(function(evt) { var panelID = panel_ + $(input).val(); evt.preventDefault(); $(panelID).toggle('fast'); }); }); /script It appeared to work just like I hoped... until I put in a second button/panel pair, with button ID= ACME_widget-mach2 and panel ID= panel_ACME_widget-mach1. What happens is, regardless of which button I click, only the first panel, the one with ID=panel_ACME_widget-mach1 is toggled. It's as if when any button is clicked, the value I am getting is the value of the first button in the collection. I put in an alert box right after declaring the variable to test this: alert(panelID); and sure enough, the value that displays is the value assigned to the first of these buttons on the page. So what am I doing wrong here? How can I get the value of the button that is actually clicked? Thanks! Alan
[jQuery] Re: (validate) validator is undefined error
Use this rule. whyvisitother: { required: function(element) { return $([name=whyvisit]).index($ ([name=whyvisit]:checked)) == 4; } On Oct 29, 7:34 am, Collectonian collecton...@gmail.com wrote: With the suggestion earlier, everything is working great, yay! All of my validation rules are also working, as well, except I can't figure out how to write the rule for my multi-option check box that has an Other option so that if other is among those checked, it will require the other input box be filled in. I have two similar ones like that, but since they are radio buttons, I was able to just use rules based on the demos. The rules I have and the relevant bit of the HTML form below for easier reading. Basically, if one of the options selected in the whyvisit set of checkboxes is the other option, the whyvisitother input field needs to be required. ~~ SNIPPET ~~ rules: { recommend: required, howlearnedother: { required: function(element) { return $('#howlearned input[name=howlearned]:checked').val() == 0; } }, describeyouother: { required: function(element) { return $('#describeyou input[name=describeyou]:checked').val() == 0; } } }, ~~HTML ~~ label for=whyvisitWhy did you visit the SRAC web site?/label div id=whyvisit input name=whyvisit type=checkbox class=checksandradios value=1 / Aquaculture producer looking for informationbr / input name=whyvisit type=checkbox class=checksandradios value=2 / Educator looking for information for my classroombr / div id=whyvisiteducator select name=whyvisiteducator option value=1Middle School/option option value=2High School/option option value=32-Year College/option option value=44-Year College/option /select /div input name=whyvisit type=checkbox class=checksandradios value=3 / Studentbr / div id=whyvisitstudent select name=whyvisitstudent option value=1Middle School/option option value=2High School/option option value=32-Year College/option option value=44-Year College/option /select /div input name=whyvisit type=checkbox class=checksandradios value=4 / Individual interested in learning more about aquaculturebr / input name=whyvisit type=checkbox class=checksandradios value=0 / Other input id=whyvisitother name=whyvisitother type=text value= size=30 maxlength=30 / br / /div
[jQuery] Re: (validate) validator is undefined error
Change var validator = $(#surveyForm).validate({ to var validator = $(form).validate({ or form action=?event=submitSurvey method=post fieldset id=surveyForm to form id=surveyForm action=?event=submitSurvey method=post fieldset Good luck. On Oct 28, 7:54 am, Collectonian collecton...@gmail.com wrote: I'm trying to implement Validate on a survey form that has just a few basic requirements. I'm running jQuery 1.3.2 and Validate 1.5.5. Whenever I try to run the code, however, I get an error that validator is undefined. I tried Googling and found only a few hits, most saying the HTML was invalid. Checked that, corrected a few minor errors, but still getting the error. In addition to the code below, I tried just the basic $(#surveyForm).validate() but it still gives the same error. This is on a development application, so it isn't available online yet. Summer SNIPPET FROM JS FILE var validator = $(#surveyForm).validate({ rules: { recommend: required, howlearnedother: { required: function(element) { return $('#howlearned input[name=howlearned]:checked').val() == 0; } }, describeyouother: { required: function(element) { return $('#describeyouother input [name=describeyouother]:checked').val() == 0; } } }, messages: { recommend: Please indicate if you would recommend the SRAC site to others, howlearnedother: Please indicate how you learned about SRAC's publications., describeyouother: Please indicate your industry. } }); ~~~SNIPPET OF HTML FORM form action=?event=submitSurvey method=post fieldset id=surveyForm legendPlease complete this survey to help us improve our offerings:/legend label for=recommendWhat is the likelihood that you would recommend the SRAC web site or its publications to your family and friends? Choose one number below with 1 = not likely and 10 = highly likely./label div id=recommend input name=recommend type=radio value=1 / 1 input name=recommend type=radio value=2 / 2 input name=recommend type=radio value=3 / 3 input name=recommend type=radio value=4 / 4 input name=recommend type=radio value=5 / 5 input name=recommend type=radio value=6 / 6 input name=recommend type=radio value=7 / 7 input name=recommend type=radio value=8 / 8 input name=recommend type=radio value=9 / 9 input name=recommend type=radio value=10 / 10 /div label for=howlearnedHow did you learn about SRAC publications? /label div id=howlearned input name=howlearned type=radio class=checksandradios value=1 / Linked from another web sitebr / input name=howlearned type=radio class=checksandradios value=2 / Search enginebr / input name=howlearned type=radio class=checksandradios value=3 / Professional (e.g. Fisheries/aquaculture biologists)br / input name=howlearned type=radio class=checksandradios value=4 / Extension programbr / input name=howlearned type=radio class=checksandradios value=5 / Friendbr / input name=howlearned type=radio class=checksandradios value=6 / Magazinebr / input name=howlearned type=radio class=checksandradios value=7 / Bookbr / input name=howlearned type=radio class=checksandradios value=0 / Other input id=howlearnedother name=howlearnedother value= type=text size=30 maxlength=30 /br / /div label for=whyvisitWhy did you visit the SRAC web site?/label div id=whyvisit input
[jQuery] Re: show/hide problem
If a.more is a child of the div, use this code. $(document).ready(function() { $(div.featured-cell-padding).mouseenter(function(){ $(this).find(a.more).show(); }); $(div.featured-cell-padding).mouseleave(function(){ $(this).find(a.more).hide(); }); }); On Oct 25, 1:13 am, Daniel Donaldson d8nieldonald...@gmail.com wrote: I am trying to have a image (link button) appear within a div on mousenter for the div, and disappear on mouseleave. I have this working in the following code as expected, but I only want it to apply to the specific div that is being entered/left. The way I have it right now it applies to the class, so every div with the class will trigger the function, which is not the desired effect : ( What I would like to have it do is have the image show/hide only within the specific div that is being entered/left. Due to the nature of the project, I cannot simply apply id's to the divs as a solution. The code follows, I apologize that I cannot provide a live link, it isn't online yet, but I have pasted the code below: // $('a.more').hide(); // $('div.featured-cell-padding').mouseenter(function() { $('a.more').show(); return false; }); // $('div.featured-cell-padding').mouseleave(function() { $('a.more').hide(); return false; }); }); thanks for any help/insight/words of wisdom :)
[jQuery] Re: How to know which button is clicked
Use a variable? var buttonClicked = ''; $(#delete).click(function(){ buttonClicked ='delete'; . }) $(#view).click(function(){ buttonClicked ='view'; . }) submitHandler: function(form) { if(buttonClicked == 'delete') {//do delete} else if (buttonClicked == 'view') {//do view} } } On Oct 24, 6:20 am, mathie trung...@gmail.com wrote: Hello, I have a form with two buttons: Delete and View. A checkbox is required for all actions. Validation happens when a button is clicked. If it's View, it is just a normal operation. However, if it's Delete, if the form is valid, it then needs to show a confirmation before form submission via custom handler (submitHandler). submitHandler: function(form) { if (confirmDelete()) { form.submit (); } } Problem: How do I know if the button is Edit or Delete inside submitHandler? The function above open the dialog even for View button. Thanks for any suggestion.
[jQuery] Re: Prevent key to change values
Put the calculation logic in blur event? $(input[type='text']:order).blur(function(){ $('#total_buyed').val( v * 2.75 ); }) On Oct 26, 4:18 am, ReynierPM rper...@uci.cu wrote: Hi every: I have this function: $(input[type='text']:order).keyup(function() { var v = $(this).val().replace(/\D/g,''); // removes non numbers $('#total_buyed').val( v * 2.75 ); }); The function is working correctly but when I press any key the same operation is calculated. How to avoid this? See online athttp://jose-couto.com/pintpal4/order_pintpal2.html Cheers and thanks in advance -- ReynierPM
[jQuery] Re: Is it possible to clone all attributes on an element and copy to a DIFFERENT type of element?
Try this. script type=text/javascript $(document).ready(function() { $(#convert).click(function() { re = /TEXTAREA/g; $(#newContainer).append($(div/).append($ (#test)) .html() .replace(re, DIV)); }); }); /script -- HTML Old Container div id=container textarea id=test class=test name=testThis is text area/ textarea /div New Container div id=newContainer /div div input type=button id=convert value=convert / /div On Sep 24, 7:51 am, mawcreative michael.a@gmail.com wrote: OBJECTIVE: Copy all the attributes of a TEXTAREA element then apply them to a new element (ie. a DIV) and finally delete the original TEXTAREA element. POSSIBILE SOLUTIONS: 1) I could write a function that cycles through all possible attribute names (ie. class, style, title, name, id, etc.) and if they exist copy their values to the DIV element (but this seems intensive -- is there a shortcut?) 2) I looked at trying to set the .nodeName property but it only has a getter method, not a setter method (it's read-only) Any ideas? Thanks in advance...
[jQuery] Re: triggering handlers for native events
You are right, when click() event is triggered, the check box/radio button value is the original value. Use change(fn) to detect the after click() value. On Sep 11, 10:40 am, Mike McNally emmecin...@gmail.com wrote: Am I the only person who finds wildly wrong the jQuery behavior of handler invocation for native events on state-changing elements like check boxes and radio boxes? Specifically, when the user clicks a check box or a radio box, the state of the element is changed and then the handler is invoked. However, when I call click() on the elements, the handler is invoked *before* the element value is updated. That makes it pointlessly difficult to write handler routines that need to look at the value to know what to do. Am I just doing something wrong? This is something I've been dealing with for years now and it's always driven me nuts. -- Turtle, turtle, on the ground, Pink and shiny, turn around.
[jQuery] Re: key - value
You can use array. var arr = new Array(); arr['Some Text 1'] = 41; arr['Some Text 2'] = 42; arr['Some Text 3'] = 43; arr['Some Text 4'] = 44; arr['Some Text 5'] = 45; alert(arr['Some Text 4']) On Sep 10, 12:43 am, TiGeRWooD tigwod.e...@gmail.com wrote: Hi, Is there a way to use $key = $value 45 = 'some text' And search in $value (some text) but when I select 'some text', it's the $key (45) as input value instead 'some text' ? Thanks in advance. ps : sorry for my poor english.
[jQuery] Re: How can I get current Index?
This works, but there could be a more elegant way to do it. $(document).ready(function() { var cnt; $(tr).each(function() { cnt = 0; $(this).find(td).each(function() { $(this).find(a).each(function() { alert(cnt) }); cnt++; }); }); }); On Sep 6, 12:28 pm, din dingl...@gmail.com wrote: TR TD1/TD TDJM-53/TD TD--/TD TD--/TD TD--/TD TDA href=#ROHs/A/TD/TR TR TD2/TD TDJM-54/TD TDA href=#ROHs/A/TD TD--/TD TD--/TD TDA href=#ROHs/A/TD/TR I want the value of href in first tag A is equal to JM-53_5.htm. And the the value of href in 2nd tag A is equal to JM-54_2.htm. The value of href in 3rd tag A is equal to JM-54_5.htm. HOW can I get the current Index of the tag A,and HOW TO get the value of the current 2nd tag TD. MANY MANY THANKS
[jQuery] Re: Select Span with Span Parent
Is this what you are after? $(span span) On Sep 1, 12:14 pm, a1anm alanmoor...@gmail.com wrote: Hi, How would I select all spans which have a span as a parent? Thanks!
[jQuery] Re: Append data using Slide In animation
try this $(data).appendTo(#chat_box).show(); On Aug 31, 3:14 am, Namir namiras...@hotmail.com wrote: Well I want to append some data to a div called chat_box but I want it to slide in from the bottom as it appears, the code Im currently using to attempt to reach this is success: function(data){ $('#chat_box').append(data.show(slide, {direction: down}, 1000)); }, but this doesnt append the data at all. I've also tried this success: function(data){ $('#chat_box').append(data).show(slide, {direction: down}, 1000); }, but this just adds the effect to the whole div instead of just the append data. For the whole code visitwww.forsakenrealms.co.cc/chat/?user=1
[jQuery] Re: Limit nextAll
Assuming you are looking for div .nextAll(div:lt(2)).each(function(){}); On Aug 28, 6:55 pm, Jaggi jaggi_2...@hotmail.com wrote: Basically i'm going through a table, i've used closest to get the parent element which is a tr then i can use next() to get the next one or nextAll() to get all the next ones however i just want to get the next two elements so is there a way to limit nextAll() to only return the next two matches rather than all of them?
[jQuery] Re: jQuery Form Plugin ajax submit
To protect the input fields, use readOnly instead of disabled and the value will be included. On Aug 21, 9:39 pm, Chris Hall sifuh...@gmail.com wrote: Using the following code: $('.input_all').attr(disabled, disabled); for input texts with the class=input_all seems to break jQuery forms ajax submit. How can I fix this?
[jQuery] Re: previous value ands remote validation
May be you should put the remote validation in field A instead of B, passing both A and B values to the server side. On Aug 26, 4:42 pm, marcp marc.past...@gmail.com wrote: hi all, i have 2 fields in my form with 1 being currently validated with a remote method (say Field B). I would like to make a dependency between fieldA and fieldB so i tried to add a blur function on field A with jQuery(#FieldB).valid() but when i change FieldA's value no remote validation occurs because there is a check (if value != previous value) is there a way for me to disable this cache ? or to reset previous data ? thanks for any help. regards, marc
[jQuery] Re: JQuery with Crystal Reports .Net 2.0
On the server side (CR XI), export the report to PDF and stream it to the client, much less problem than using CR viewer. On Aug 26, 3:06 am, ND desaid...@gmail.com wrote: Hello, Has anyone attempted using JQuery dialog to display crystal reports in .Net 2.0? Also, the crystal report viewer is within and AJAX update panel. We are trying to implement that and having nightmarish issues with printing and exporting the reports. If I use full postbacks from the report viewer, it closes the JQuery dialog. If I use async postbacks, there is no event to trigger the printing. Has anyone experienced this? Any help is greatly appreciated. Thanks, ND
[jQuery] Re: Which event to use with form elements
Can't you use change()? From the jquery docs. The change event fires when a control loses the input focus and its value has been modified since gaining focus. $(form Input, form select).change(function(){ alert($(this).val()); }); If you want to detect the value before lost focus, you have to use keyup event. //The script is not tested $(form Input, form select).each(function(){ var origVal = $(this).val(); $(this).keyup(function(){ // you may want to compare the new value with the orig value from 0 to nth position if ($(this).val() != origVal) alert($(this).val()); }); }); On Aug 23, 1:42 pm, André Hänsel an...@webkr.de wrote: Hi, is there any event that I can use to trigger an action immediately when a form element is changed? (And similarily when it is changed and then looses the focus.) I think JS does not provide such an event but maybe jQuery provides some kind of virtual event for this case? Regards, André
[jQuery] Re: :first relative to clicked element
I tested this and it works with FF3.0 and IE 8.0 $(#content).find(blockquote) .hide() .before(h6Click for more.../h6) .end() .find('h5').click(function() { $(this).nextAll('blockquote:first') .slideToggle('slow') .end() .nextAll('h6:first').slideToggle('slow'); }); On Aug 21, 5:28 pm, Carl-Johan Lindqvist cj.lindqv...@gmail.com wrote: Hi Jules and thanks for your reply. Sadly, that didn't work (though I now use your $(this).nextAll ('blockquote:first') to select the blockquote, it looks better than .next().next() ) Might the problem with the h6 tag has something to do with the fact that the whole h6More../h6 is added by jQuery itself; $('blockquote').prev().append( 'h6More.../h6' ); ? Thanks again! On Aug 21, 6:20 am, Jules jwira...@gmail.com wrote: $('#content').find('blockquote') .hide() .end() .find('h5').click(function() { $(this).nextAll('blockquote:first') .slideToggle('slow') .end() .nextAll('h6:first').slideToggle('slow'); }); On Aug 21, 3:08 am, Carl-Johan Lindqvist cj.lindqv...@gmail.com wrote: Hi I'm just learning jQuery and have some troubles with the selectors. I'm using this (found in the basic training file) to show and hide a Blockquote paragraph. $('#content').find('blockquote').hide().end().find('h5').click(function () { $(this).next().next().slideToggle('slow'); $(h6:first).slideToggle('slow'); }); Basically I have a h5 with a title, then a p with the first paragraph of text, and then I have the rest of the text wrapped in a blockquote tag (this is all WordPress, that's why the syntax might be a little strange). Under the blockquote I have a h6Click for more.../h6 which I'd like to hide when the blockquote is shown. This is then repeated a couple of times.. something like: h5Title/h5 pIntro/p blockqoutepThe rest of the text/p/blockqoute h6Click for more.../h6 h5Title/h5 pIntro/p blockqoutepThe rest of the text/p/blockqoute h6Click for more.../h6 h5Title/h5 pIntro/p blockqoutepThe rest of the text/p/blockqoute h6Click for more.../h6 Now the code I have works fine for the first set of lines (when I click the h5 the blockquote slides out and the h6 slides away. But h6:first is (apparently) relative to the whole document and not to the h5 you just clicked, so when I click the second h5 it's the h6 in the first set that disappears. How can I write it so that only the first h6 after the h5 is toggled? Thank you!
[jQuery] Re: invalid object initializer. Pls Help
The first parameter format for Animate should be {width:'100px'} instead of {width, '100px'} On Aug 21, 2:07 am, NotoriousWebmaster alfred.aya...@gmail.com wrote: I'm trying to animate a couple of fields in a form. When the focus lands on field A it grows to 300px and fieldB shrinks to 100px. When focus lands on field B, it grows to 300 and field A shrinks to 100px. Here's my code: function resizeSearchAsk() { console.log('SearchAsk'); $('#fldA').animate({'width', '100px'}, 'slow'); $('#fldB').animate({'width', '300px'}, 'slow'); } function resizeAskSearch() { console.log('AskSearch'); $('#fldA').animate({'width', '300px'}, 'slow'); $('#fldB').animate({'width', '100px'}, 'slow'); } $(document).ready(function() { console.log('ready start'); $('#fldA').focus(resizeSearchAsk); $('#fldB').focus(resizeAskSearch); console.log('ready end'); }); Just loading the page I get a console error in FireBug: invalid object initializer On this line: $('#fldA').animate({'width', '100px'}, 'slow'); Which is in the first function resizeSearchAsk(). I'm not getting the log msg in the ready function. Any idea what I'm doing wrong? I can giove you the entire file if you want (it's not long: a test.) Thx, - AAA
[jQuery] Re: :first relative to clicked element
$('#content').find('blockquote') .hide() .end() .find('h5').click(function() { $(this).nextAll('blockquote:first') .slideToggle('slow') .end() .nextAll('h6:first').slideToggle('slow'); }); On Aug 21, 3:08 am, Carl-Johan Lindqvist cj.lindqv...@gmail.com wrote: Hi I'm just learning jQuery and have some troubles with the selectors. I'm using this (found in the basic training file) to show and hide a Blockquote paragraph. $('#content').find('blockquote').hide().end().find('h5').click(function () { $(this).next().next().slideToggle('slow'); $(h6:first).slideToggle('slow'); }); Basically I have a h5 with a title, then a p with the first paragraph of text, and then I have the rest of the text wrapped in a blockquote tag (this is all WordPress, that's why the syntax might be a little strange). Under the blockquote I have a h6Click for more.../h6 which I'd like to hide when the blockquote is shown. This is then repeated a couple of times.. something like: h5Title/h5 pIntro/p blockqoutepThe rest of the text/p/blockqoute h6Click for more.../h6 h5Title/h5 pIntro/p blockqoutepThe rest of the text/p/blockqoute h6Click for more.../h6 h5Title/h5 pIntro/p blockqoutepThe rest of the text/p/blockqoute h6Click for more.../h6 Now the code I have works fine for the first set of lines (when I click the h5 the blockquote slides out and the h6 slides away. But h6:first is (apparently) relative to the whole document and not to the h5 you just clicked, so when I click the second h5 it's the h6 in the first set that disappears. How can I write it so that only the first h6 after the h5 is toggled? Thank you!
[jQuery] Re: Using $.ajax to post XML to an aspx page
Can't you pass the xml as a string and load it to dom on the server side? On Aug 19, 1:39 am, Karl kcrichard...@gmail.com wrote: I'm new to using JQuery and I've been searching everywhere to be able to post XML to a WebMethod on an aspx page in a site. I'm sure it can be done but I just have no idea how. Any help would be greatly appreciated!
[jQuery] Re: how to get back the DOM element as HTML source
Use DHTML property. $(table:first)[0].outerHTML On Aug 19, 12:36 am, John jian.fang.subscr...@gmail.com wrote: Thanks, Anurag. Let me rephrase my question. For example, I can use the following jQuery to get the html source of a table element $(table:first).html() The returned html source does not include the table itself, I like to see the html source starting from the table, for example, table class=aaa .. /table Is there any jQuery function for this? If not, how do I implement this? Thanks in advance, John On Aug 18, 2:06 am, anurag pal mail.anurag@gmail.com wrote: Hi John, After setting the html by using html method you have to bind the DOM elements using bind method. Example: script type=text/javascript $(.pge).bind(click, function(e){ var options = {}; $.ajax({ url: data_retrieval.php, cache: false, type: GET, data: ({id : this.getAttribute('id')}), success: function(html){ $(#slacker_detail_view).html(html); $('#slacker_detail_view').show('blind', options, 1500); } }); }); /script Regards, Anurag Pal On Tue, Aug 18, 2009 at 7:40 AM, John jian.fang.subscr...@gmail.com wrote: Hi, How do I get back the DOM element as HTML source using jQuery? The html () method only returns the innerHTML and it does not include the UI element itself. But I am more interested in converting the UI element itself to HTML. Thanks in advance, Jian
[jQuery] Re: Could you give some advise on studying JQuery Code Source.
Are you a beginner? If you are, this web site is a good one. http://www.w3schools.com/ On Aug 17, 1:55 pm, Jackwanzai jackwan...@gmail.com wrote: Hi all, I have been using JQuery for some time, finding it very interesting and elegant. I want to study the code source. But found I was confused by many code. Do you have some website or books to recommend me to refer to? Thank you very much!
[jQuery] Re: manipulate elements with filter
I am not sure what do you want to do. Assuming you want to set the new input value and a text (not the cleanest code though): $(#clickmeIMg).click(function() { var insertDataBefore = $('#tablaFormulario').find('tr:last') insertDataBefore.clone(true) .insertAfter(insertDataBefore) .find(td) .each(function() { $(this).find(input).val(new value); $(this).find(a).text(new link); }); }); On Aug 18, 7:21 am, Wolf ventas.w...@gmail.com wrote: Hi, I need clone a row and update the elements inside of them, but i cant update elements dynamically. example Jquery. $(#clickmeIMg).click(function(){ var insertDataBefore = $('#tablaFormulario').find('tr:last') insertDataBefore.clone(true).insertAfter(insertDataBefore).find (td).filter(function(){ alert($(this).html()); }); }); The element return 3 alerts return : - first alert return a select - second alert return input - third alert return a img this element i can`t capture data for update new row. i try with array and convert to array but nothing. any idea ? Example HTML tr td valign=top SELECT name=tipo0 id=tipo0 class=caja onBlur=style.backgroundColor='' option value= selectedSeleccione/option %set rsTipo = ConnInformatica.Execute(exec tipo_consulta) if not rsTipo.eof then do while not rsTipo.eof response.Write(option value=' ucase(trim(rsTipo(idTipo))) ' ucase(trim(rsTipo(tipo))) /option) rsTipo.MoveNext loop else response.Write(OPTION value=''NO EXISTEN DATOS/OPTION) end if rsTipo.Close Set rsTipo = Nothing% /select /td td valign=topinput name=informacion0 type=text class=caja id=informacion0 size=88 maxlength=50 onBlur=style.backgroundColor=''/td td align=center class=fondo_claroimg src=../../ Utilidades_intranet/Imagen/icon/eliminar.gif alt=ELIMINAR FILA class=opacity/td /tr
[jQuery] Re: Click() Not Working
$(td a.menu:contains('Main')).click() should work. Can you post the html? On Aug 14, 4:48 am, S2 smnthsm...@gmail.com wrote: This doesn't work in IE or Firefox: $(td a.menu:contains('Main')).click(); This works in IE: $(td a.menu:contains('Main'))[0].click(); $(td a.menu:contains('Main')).length is 1 What am I doing wrong?
[jQuery] Re: Input position in HTML
You should use css not jquery. On Aug 13, 10:22 pm, Baalzamon antoniodour...@gmail.com wrote: Hi, I'm making a dynamic div in a page but I'm having some doubts: -I have an input text field and i need to get it's position (left and top) to make the div appear near this input. $.(':INPUTNAME').css ('left') returns me zero like 'top' does. Is there a way to get left/top position from a static input text field on html?? Thx!!
[jQuery] Re: $ajax() question
After re-reading the original post, it seems json is not required just use data:Args=+args2 on the server side StreamReader reader = new StreamReader(Request.InputStream); string param = reader.ReadToEnd(); param = Args=abc assuming args2=abc Just use split() to get the value. On Aug 11, 1:59 pm, Jules jwira...@gmail.com wrote: JavaScriptSerializer is included in AJAX 1.0. It is compatible with .NET 2.0. http://www.asp.net/ajax/downloads/archive/ You don't have to use the ajax component on your client to use it. On Aug 11, 1:18 pm, yi falconh...@gmail.com wrote: Hi Jules: If i use old version of ASP.net, Can i Deserialize Json data? thanks Jules!!! On Aug 11, 3:01 pm, Jules jwira...@gmail.com wrote: Opps, You are right, change the contentType to contentType: application/json; charset=utf-8 here is a snippet to handle generic json in C# .NET 3.5 JavaScriptSerializer ser = new JavaScriptSerializer(); StreamReader reader = new StreamReader(Request.InputStream); object input = ser.DeserializeObject(reader.ReadToEnd()); string args = ((Dictionarystring, object)input)[Args] as string; or if you have the object defined use System.Runtime.Serialization.Json.DataContractJsonSerializer More info in http://www.west-wind.com/WebLog/posts/218001.aspx On Aug 11, 12:23 pm, yi falconh...@gmail.com wrote: hi Jules: I use Request(Arg) , but it doesn't work. it always give me empty string contentType: text is it right? do i need make it contentType: Json, ? If i need use JSON, do you know how to read json data at sever side in asp.net? thanks so much!!! On Aug 11, 12:50 pm, Jules jwira...@gmail.com wrote: Use Request(Arg) instead, this syntax gets the Arg from data post or querystring. Do not enclose args2, the server will get args2 instead of the value of args2. data:{Arg:args2} On Aug 11, 10:12 am, yi falconh...@gmail.com wrote: Hi Jules: thank you for your help!! if I use this: type: POST, url: mywebpage.aspx, data:{Arg:args2} Do you know how can i get value of arg from sever side(code behind)? I use asp.net, but i dont know how to fatch data when data put inside {}, data:{Arg:args2} Can i still use Request.QueryString() function? thanks On Aug 11, 10:56 am, Jules jwira...@gmail.com wrote: There is a limit on url length depending on the browser. http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... use type:POST and data: instead and do not enclose the object declaration data:{Arg:args2} instead of data:{Arg:args2} On Aug 11, 8:41 am, yi falconh...@gmail.com wrote: $.ajax({ type: POST, url: mywebpage.aspx? Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: Validation Error message help
Check the error message existence before adding a new error msg if ($('#'+fieldName+'-exists').length = 0) $('#username').after('div class=error-messageid='+ fieldName +'- exists' + error + '/div'); On Aug 12, 2:17 am, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I have this script: $(document).ready( function() { $('#username').blur( function () { fieldName = $(this).attr('id'); fieldValue = $(this).val(); $.post('/users/ajax_validate', { field: fieldName, value: fieldValue }, function(error) { if(error.length != 0) { $('#username').after('div class=error-message id='+ fieldName +'-exists' + error + '/div'); } else { $('#' + fieldName + '-exists').remove(); } }); }); }); So when the user leaves the field it checks validation. If error it shows an error message. Everything is working fine except if the user goes back to the field where there was an error and does not chnge anything and leaves the field again the error message is duplicated. So they enter a username peter it says Please choose a different name if they go back to the username and thenleavewith out changing peter i now have: Please choose a different name Please choose a different name What do I have to change / add so that only 1 message will appear? Thanks Dave
[jQuery] Re: $ajax() question
There is a limit on url length depending on the browser. http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/get/url-parameters.html use type:POST and data: instead and do not enclose the object declaration data:{Arg:args2} instead of data:{Arg:args2} On Aug 11, 8:41 am, yi falconh...@gmail.com wrote: $.ajax({ type: POST, url: mywebpage.aspx? Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: refactoring help/ suggestions?
Assuming your html format as follows: a href=# class=pPara a/a pParagraph a/p br / a href=# class=pPara b/a pParagraph b/p br / a href=# class=pPara c/a pParagraph c/p Use this: $(document).ready(function() { $(a.p).next(p).hide(); $(a.p).hover(function() { $(this).fadeOut(slow).fadeIn(slow); var par = $(this).next(p); if (par.is(:hidden)) par.fadeIn(slow); else par.fadeOut(sloe); }); }); On Aug 11, 3:52 am, Calvin cstephe...@gmail.com wrote: Here is a solution I came up with, but there is still some repeated code. Does anyone have any suggestions I could try out to 'DRY' up my code? jQuery.fn.swapFade = function() { if (this.is(':hidden')) { this.fadeIn('slow'); } else { this.fadeOut('slow'); } }; $(document).ready(function() { $('p.a, p.b, p.c').hide(); var hash = {'one': 'a', 'two': 'b', 'three': 'c'} $('.one').hover(function() { $('a.one').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); $('.two').hover(function() { $('a.two').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); $('.three').hover(function() { $('a.three').fadeOut('slow').fadeIn('slow'); $('p.' + hash[this.className]).swapFade(); return false; }); }); On Aug 9, 11:51 am, Calvin cstephe...@gmail.com wrote: Hi, I wrote this code for a simple hide and show effect and I am looking for any advice or examples of how I can refactor the code. I tried using a hash but it didn't work out right and I am thinking that maybe I should make a object method. here is the code: $(document).ready(function() { var $firstPara = $('p.a'); $firstPara.hide(); $('a.one').hover(function() { $('a.one').fadeOut('slow').fadeIn('slow'); if ($firstPara.is(':hidden')) { $firstPara.fadeIn('slow'); } else { $firstPara.fadeOut('slow'); } return false; }); }); $(document).ready(function() { var $secondPara = $('p.b'); $secondPara.hide(); $('a.two').hover(function() { $('a.two').fadeOut('slow').fadeIn('slow'); if ($secondPara.is(':hidden')) { $secondPara.fadeIn('slow'); } else { $secondPara.fadeOut('slow'); } return false; }); }); $(document).ready(function() { var $thirdPara = $('p.c'); $thirdPara.hide(); $('a.three').hover(function() { $('a.three').fadeOut('slow').fadeIn('slow'); if ($thirdPara.is(':hidden')) { $thirdPara.fadeIn('slow'); } else { $thirdPara.fadeOut('slow'); } return false; }); });
[jQuery] Re: $ajax() question
Use Request(Arg) instead, this syntax gets the Arg from data post or querystring. Do not enclose args2, the server will get args2 instead of the value of args2. data:{Arg:args2} On Aug 11, 10:12 am, yi falconh...@gmail.com wrote: Hi Jules: thank you for your help!! if I use this: type: POST, url: mywebpage.aspx, data:{Arg:args2} Do you know how can i get value of arg from sever side(code behind)? I use asp.net, but i dont know how to fatch data when data put inside {}, data:{Arg:args2} Can i still use Request.QueryString() function? thanks On Aug 11, 10:56 am, Jules jwira...@gmail.com wrote: There is a limit on url length depending on the browser. http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... use type:POST and data: instead and do not enclose the object declaration data:{Arg:args2} instead of data:{Arg:args2} On Aug 11, 8:41 am, yi falconh...@gmail.com wrote: $.ajax({ type: POST, url: mywebpage.aspx? Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: (Validate) Error messages in Summary section
Check out errorLabelContainer http://docs.jquery.com/Plugins/Validation/validate#toptions On Aug 10, 9:32 pm, dazad...@gmail.com dazad...@gmail.com wrote: Hi, I'm new to jQuery and the validation plugin, I just wondered if it is possible to get the error messages to be shown in an error summary section instead of inline? Cheers, Daz
[jQuery] Re: $ajax() question
Opps, You are right, change the contentType to contentType: application/json; charset=utf-8 here is a snippet to handle generic json in C# .NET 3.5 JavaScriptSerializer ser = new JavaScriptSerializer(); StreamReader reader = new StreamReader(Request.InputStream); object input = ser.DeserializeObject(reader.ReadToEnd()); string args = ((Dictionarystring, object)input)[Args] as string; or if you have the object defined use System.Runtime.Serialization.Json.DataContractJsonSerializer More info in http://www.west-wind.com/WebLog/posts/218001.aspx On Aug 11, 12:23 pm, yi falconh...@gmail.com wrote: hi Jules: I use Request(Arg) , but it doesn't work. it always give me empty string contentType: text is it right? do i need make it contentType: Json, ? If i need use JSON, do you know how to read json data at sever side in asp.net? thanks so much!!! On Aug 11, 12:50 pm, Jules jwira...@gmail.com wrote: Use Request(Arg) instead, this syntax gets the Arg from data post or querystring. Do not enclose args2, the server will get args2 instead of the value of args2. data:{Arg:args2} On Aug 11, 10:12 am, yi falconh...@gmail.com wrote: Hi Jules: thank you for your help!! if I use this: type: POST, url: mywebpage.aspx, data:{Arg:args2} Do you know how can i get value of arg from sever side(code behind)? I use asp.net, but i dont know how to fatch data when data put inside {}, data:{Arg:args2} Can i still use Request.QueryString() function? thanks On Aug 11, 10:56 am, Jules jwira...@gmail.com wrote: There is a limit on url length depending on the browser. http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... use type:POST and data: instead and do not enclose the object declaration data:{Arg:args2} instead of data:{Arg:args2} On Aug 11, 8:41 am, yi falconh...@gmail.com wrote: $.ajax({ type: POST, url: mywebpage.aspx? Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: $ajax() question
JavaScriptSerializer is included in AJAX 1.0. It is compatible with .NET 2.0. http://www.asp.net/ajax/downloads/archive/ You don't have to use the ajax component on your client to use it. On Aug 11, 1:18 pm, yi falconh...@gmail.com wrote: Hi Jules: If i use old version of ASP.net, Can i Deserialize Json data? thanks Jules!!! On Aug 11, 3:01 pm, Jules jwira...@gmail.com wrote: Opps, You are right, change the contentType to contentType: application/json; charset=utf-8 here is a snippet to handle generic json in C# .NET 3.5 JavaScriptSerializer ser = new JavaScriptSerializer(); StreamReader reader = new StreamReader(Request.InputStream); object input = ser.DeserializeObject(reader.ReadToEnd()); string args = ((Dictionarystring, object)input)[Args] as string; or if you have the object defined use System.Runtime.Serialization.Json.DataContractJsonSerializer More info in http://www.west-wind.com/WebLog/posts/218001.aspx On Aug 11, 12:23 pm, yi falconh...@gmail.com wrote: hi Jules: I use Request(Arg) , but it doesn't work. it always give me empty string contentType: text is it right? do i need make it contentType: Json, ? If i need use JSON, do you know how to read json data at sever side in asp.net? thanks so much!!! On Aug 11, 12:50 pm, Jules jwira...@gmail.com wrote: Use Request(Arg) instead, this syntax gets the Arg from data post or querystring. Do not enclose args2, the server will get args2 instead of the value of args2. data:{Arg:args2} On Aug 11, 10:12 am, yi falconh...@gmail.com wrote: Hi Jules: thank you for your help!! if I use this: type: POST, url: mywebpage.aspx, data:{Arg:args2} Do you know how can i get value of arg from sever side(code behind)? I use asp.net, but i dont know how to fatch data when data put inside {}, data:{Arg:args2} Can i still use Request.QueryString() function? thanks On Aug 11, 10:56 am, Jules jwira...@gmail.com wrote: There is a limit on url length depending on the browser. http://classicasp.aspfaq.com/forms/what-is-the-limit-on-querystring/g... use type:POST and data: instead and do not enclose the object declaration data:{Arg:args2} instead of data:{Arg:args2} On Aug 11, 8:41 am, yi falconh...@gmail.com wrote: $.ajax({ type: POST, url: mywebpage.aspx? Arg=+args2, contentType: text, data:{}, dataType: text, success: CompleteInsert, error: onFail }); I dont know why the onFail function is going to be executed when args2 is too big. args2 is a string type can anyone explain this thanks
[jQuery] Re: Custom Attributes - Beginner tip
I think that is one of the reason to use class, It is cleaner than using custom attributes. May be others can share their experiences on XHTML and custom attributes? On Aug 6, 1:37 am, Cesar Sanz the.email.tr...@gmail.com wrote: What happens with custom attributes regarding the strict XHTML format? - Original Message - From: Rick Faircloth r...@whitestonemedia.com To: jquery-en@googlegroups.com Sent: Wednesday, August 05, 2009 5:12 AM Subject: [jQuery] Re: Custom Attributes - Beginner tip Thanks for the tip! -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Miket3 Sent: Tuesday, August 04, 2009 8:04 PM To: jQuery (English) Subject: [jQuery] Custom Attributes - Beginner tip One issue I ran across while learning jquery was that I often wanted/ needed a way to tell jquery to get data for the current element from a related element. jQuery immediately tends to be friendly when you need to work with a class of elements via the CLASS attribute, or a specific element via the ID attribute. However, when there are 2 elements that are related but do not fit within a class, a beginner such as myself may have a little trouble trying to find the best way to handle this issue. At this point we begin to research how to get jQuery to recognize a custom attribute, because common rules says that the ID attrib is basically out of the question as this needs to be unique to each element. And the CLASS attrib just doesn't logically help either because it can refer to too many other elements that don't fit our rule. And when we find out that jQuery doesn't readily recognize custom attributes it can get a little intimidating because one of the solutions is to extend jQuery. But there are a couple of other standard attributes that are recognized but rarely used. In my particular case I started using the TITLE attribute for relating my elements. But then I stumbled upon the correct way, (or at least until someone corrects me on this post). There is a REL attribute which can be used to RELATE the to elements. So when you feel like you need a custom attribute, you might not need one, the REL is available and the TITLE could be used as a backup if necessary. I hope this helps someone.
[jQuery] Re: xpath not returning objects
jQuery does not recognise @ as attribute indicator. Just remove the @ from your code and enclose the attribute value with ': $(input:checkbox[name='media_type']).click(function() { if (this.checked == true) { alert('checkbox true'); $(div[class='mediafield']).hide ('fast'); }); On Aug 5, 7:55 am, Old Orange Juice kc2...@gmail.com wrote: I have a bunch of divs with the same classname, 'mediafield': div id=articles class=mediafieldSlug:/divbr div id=video class=mediafieldBig Blurb(Video)br/div div id=content_short class=mediafieldBig Blub(short content) br/div div id=audio class=mediafieldBig Blub(Audio)br/div div id=images class=mediafieldPhoto Uri(images):br/div and I have this jquery code in my header: script $(document).ready(function() { $(input:checkb...@name=media_type]).click(function() { if (this.checked == true) { alert('checkbox true'); $(d...@class=mediafield]).hide('fast'); });}); /script So I know that the click function is getting implemented.. The alert box appears however I get the following error in firebug: uncaught exception: Syntax error, unrecognized expression: [...@class=mediafield] Line 0 Nothing happens when firebug is turned off... So I'm not sure why it's throwing the error. Any help? Thanks, ooj
[jQuery] Re: Custom Attributes - Beginner tip
jQuery support custom attributes, may be you can post a sample? Anyway, this works $(document).ready(function(){ alert($([custom='test']).length); }); input type=text id=text1 name=text1 custom=test / input type=text id=text2 name=text2 custom=test / input type=text id=text3 name=text3 custom=test / input type=text id=text4 name=text4 custom=test / On Aug 5, 10:04 am, Miket3 miketro...@gmail.com wrote: One issue I ran across while learning jquery was that I often wanted/ needed a way to tell jquery to get data for the current element from a related element. jQuery immediately tends to be friendly when you need to work with a class of elements via the CLASS attribute, or a specific element via the ID attribute. However, when there are 2 elements that are related but do not fit within a class, a beginner such as myself may have a little trouble trying to find the best way to handle this issue. At this point we begin to research how to get jQuery to recognize a custom attribute, because common rules says that the ID attrib is basically out of the question as this needs to be unique to each element. And the CLASS attrib just doesn't logically help either because it can refer to too many other elements that don't fit our rule. And when we find out that jQuery doesn't readily recognize custom attributes it can get a little intimidating because one of the solutions is to extend jQuery. But there are a couple of other standard attributes that are recognized but rarely used. In my particular case I started using the TITLE attribute for relating my elements. But then I stumbled upon the correct way, (or at least until someone corrects me on this post). There is a REL attribute which can be used to RELATE the to elements. So when you feel like you need a custom attribute, you might not need one, the REL is available and the TITLE could be used as a backup if necessary. I hope this helps someone.
[jQuery] Re: A few novice questions on Datepicker
Most of your questions can be answered by the date picker docs http://docs.jquery.com/UI/Datepicker 1. Use minDate option 2. If I correctly understand the question, use dateFormat option 3. .ui-icon-circle-triangle-e and .ui-icon-circle-triangle-w. This website allow you to change the ui theme http://jqueryui.com/themeroller/ On Jul 31, 9:03 am, wei vwu...@gmail.com wrote: I just plug in the JQuery into my Spring application. It looks great. I have a few questions in the regards: 1. how to configure the Datepicker so that only the current and future date can be picked? 2. how to let the initial date shown as the date format used in the field? 3. what are the forward and backward arrow icon names? I make a very minor modification on the CSS file so that the datepicker will popup on top of my page. I can't find the arrow icon names in the CSS file. Thanks.
[jQuery] Re: How to show a div upon a validation error?
Hopefully this help. -- html !-- notice the name field is required by validate plug in to uniquely identify the element -- input id=field1 name=field1 type=text class=required / !-- Use attribute for with the relevant element. -- label for=field1 style=display:noneError text for field1/label -- script var options = { errorPlacement: function(error, element) { $(label[for=' + element[0].id + ']).addClass (this.errorClass).show(); } }; $(form).validate(options); On Jul 31, 2:11 am, Rudi Cheow rudich...@gmail.com wrote: Hi all, Please see this code: form id=myform input id=field1 type=text class=required / div id=field1errorError1/div input id=field2 type=text class=required / div id=field2errorError2/div /form The above is a simplified version of my code, but it shows enough. The two DIVs are set to display:none. How do I invoke the validate plugin in such a way that it shows the appropriate DIV when validation fails on the relevant field? I have been pulling my hair out over this, and the fact that this is my first serious foray into jQuery territory doesn't help. Any assistance appreciated. Thanks.
[jQuery] Re: small problem
Using Vista 64 FF3.0.1 the letters change to yellow as mentioned. Works fine in IE 8 On Jul 26, 7:40 pm, GaVrA ga...@crtaci.info wrote: Hmm check out my site: http://www.crtaci.info/ on top-right position i have search field. When you move your mouse over there small text shows up that says: Napredna pretraga Now, for some reason those letters change color to like yellow for very short period of time in ff 3.5 and to some strange color in safari 4.0.2 for win. In ie8, opera and chrome it works just the way it should, white letters stay white during the animation. Any sugestions?
[jQuery] Re: (validate) multiple error error messages per input
I tested your HTML using IE and FF in both cases the error message is only displayed once using jquery.1.3.2 and validate 1.5.4. Try to step through the validate code to find the error. BTW, it is a good idea to close your input tag input id=blah name=blah type=text / On Jul 30, 1:03 am, jckos johncar...@gmail.com wrote: Thanks for the reply. My form looks like what you describe, but I still have the problem FIELDSET LEGENDshipping address/LEGEND LABEL for=firstname accesskey=f class=labelRequiredfirst name small class=labelRequired*/ small:/LABEL INPUT type=text id=firstname name=firstname tabindex=1 value= title= class=required LABEL for=lastname accesskey=l class=labellast name small class=labelRequired*/small:/LABEL INPUT type=text id=lastname name=lastname tabindex=2 title=last name class=required LABEL for=company accesskey=c class=labelRequiredcompany:/ LABEL INPUT type=text id=company name=company tabindex=3 title=company LABEL for=street address accesskey=s class=labelRequiredstreet address small class=labelRequired*/ small/LABEL INPUT type=text id=streetAddress name=streetAddress tabindex=4 title=street address class=required LABEL for=address line 2 accesskey=a class=labelRequiredaddress line 2:/LABEL INPUT type=text id=addressLine2 name=addressLine2 tabindex=5 title=address line 2 LABEL for=company accesskey=c class=labelRequiredcity small class=labelRequired*/small:/ LABEL INPUT type=text id=city name=city tabindex=6 title=city class=required /FIELDSET On Jul 27, 9:07 pm, Jules jwira...@gmail.com wrote: Since you didn't post your html and code, I would guess you don't have name property specified on your html. input type=text id=username/input should be input type=text id=username name=username/input On Jul 28, 8:26 am, jckos johncar...@gmail.com wrote: Hi, If I focus on a field multiple times or submit the form multiple times, I the script adds multiple error messages per field, both valid and error classes, depending on the data entered. Any suggestions? Thanks, John
[jQuery] Re: jQuery Nesting Tables
As mentioned by FrenchiINLA, $(table tr:has(table)) or $(.list tr:has(table)) should do it. On Jul 29, 5:04 am, nullstring jayz...@gmail.com wrote: Hi, am not sure if I'm doing this right .. I have here the function to move the paging from GridView(table) generated by .NET, on top/before the table(GridView), and put it inside the DIV element. Problem is, the condition there: if($('tbody tr:last td:has(table)', this).length 0) doesn't work. I have provided a simplier table and expected result at the bottom. - JQuery Code : Start --- jQuery.fn.CreatePagingOnTop = function() { if(jQuery(this).is('table')) { if($('tbody tr:last td:has(table)', this).length 0) { // need to check if the paging table exists in the last row of the table this.before('divtable id=\'pages\'/table/div'); this.find('tbody tr:last').remove().appendTo($(#pages)); } } return this; } $(document).ready(function() { // let's remove our paging and create // DIV element on top of table element and move the paging there.. $(#scrollTable).CreatePagingOnTop(); }); - JQuery Code : END --- - HTML: Table problem, simplified : Start --- table thead thhead 1/th thhead 2/th /thead tbody tr tdcol 1 r1/td tdcol 2 r1/td /tr tr tdcol 1 r2/td tdcol 2 r2/td /tr tr td colspan=2 !-- start of paging table, which is conditionally generated depends on Items/Row Per Page. Conditionally: because if current items/row in page displayed is lesser than Items/Row Per Page, this table will not be generated. I have to set a condition on my jQuery so it will not remove and move the last row which could be a data values, instead of the Page links. -- table border=0 tr tdspan1/span/td tda href=2/a/td /tr /table /td /tr /tbody /table - HTML: Table problem, simplified : END --- - HTML: Expected result : Start div table tr tdspan1/span/td tda href=2/a/td /tr /table /div table id=scrollTable thead thhead 1/th thhead 2/th /thead tbody tr tdcol 1 r1/td tdcol 2 r1/td /tr tr tdcol 1 r2/td tdcol 2 r2/td /tr /tbody /table - HTML: Expected result : Start - HTML: Result if no condition and no Page links table : Start - div table tr tdcol 1 r2/td tdcol 2 r2/td /tr /table /div table thead thhead 1/th thhead 2/th /thead tbody tr tdcol 1 r1/td tdcol 2 r1/td /tr /tbody /table - HTML: Result if no condition and no Page links table : END - Please?
[jQuery] Re: fn question
From the jquery plugin http://docs.jquery.com/Plugins/Authoring Your method must return the jQuery object, unless explicity noted otherwise. $('input#btn').btnClick().css(background-color,blue) won't work for your 1st case but works for the 2nd one. On Jul 30, 3:14 pm, David .Wu chan1...@gmail.com wrote: I found these both work, so what is return for? script $.fn.btnClick = function() { this.click(function() { alert('test'); }); } $('input#btn').btnClick(); /script script $.fn.btnClick = function() { return this.click(function() { alert('test'); }); } $('input#btn').btnClick(); /script
[jQuery] Re: (validate) multiple error error messages per input
Since you didn't post your html and code, I would guess you don't have name property specified on your html. input type=text id=username/input should be input type=text id=username name=username/input On Jul 28, 8:26 am, jckos johncar...@gmail.com wrote: Hi, If I focus on a field multiple times or submit the form multiple times, I the script adds multiple error messages per field, both valid and error classes, depending on the data entered. Any suggestions? Thanks, John
[jQuery] Re: JQuery method to update one form element with value from another
Try the most obvious method: '(#hiddenfieldId).val(' or '(#hiddenfieldId)[0].value =' or '(#hiddenfieldId).get(0).value =' assuming the hidden field is as specified below and the coder using uniqueid. input type=hidden id=hiddenfieldId name=hiddenfieldId / If the code cannot be found, the original coder may use class name or other attributes. Good luck, modifying a 4000+ lines of code web page is a very challenging task On Jul 28, 7:38 am, OccasionalFlyer klit...@apu.edu wrote: I need to make a change to a web page that has lots of JQuery things in it, it appears. Not knowing anything about the actual use of JQuery, however, while I will start looking at the doc, can someone help me with what to look for in a 4000+ line file to find out where the value is being set for the hidden field. I have been unable to identify this. There appears to be no onChange or onSubmit JavaScript call. I have been given this file with the need to figure this out right away, with a very tight timeline to make many changes, so this one item can't take the time required to start learning the whole of JQuery before I can make a change. Thanks.
[jQuery] Re: Customize Error Labels
This should work instead of going through all labels. $('form').validate({ errorPlacement: function(error, element) { $('label[for=' + $(element).attr('id') + ']').addClass('error'); }); } }); On Jul 23, 4:00 pm, Rizky br4inwas...@gmail.com wrote: Ahh, Thx for the reply. I get it now :) But my labels isn't always the previous element before the fields. So I changed it to suit my markup. Like this: $('form').validate({ errorPlacement: function(error, element) { $('label').each(function() { var field_for = $(this).attr('for'); var field_id = $(element).attr('id'); if (field_for == field_id) { $(this).addClass('error'); } }); } }); Nothing fancy, but it works... Btw, thx for the help.. On Jul 23, 12:17 pm, Jules jwira...@gmail.com wrote: Read errorPlacement on validate docs. $(document).ready(function() { $(form).validate({ errorPlacement: function(error, element) { $(element).prev().addClass(error); } }); }); labelInput:/labelinput type=text id=txtInput name=txtInput class=required / On Jul 23, 3:03 pm, Rizky br4inwas...@gmail.com wrote: Hi, I need help with the Validation plugin. I want to disable the generated error labels and I need to find a way to add the class error to existing form labels instead. Currently I don't use it and simply want to add highlighting to the existing fields and labels. My forms already contain fields with corresponding labels (using the basic for - id relationship). And all i need to do now is to add the class error to these labels if the corresponding fields has errors. Sorry if this question have been asked before. Thx
[jQuery] Re: Need help with a custom selector to bind ajax callbacks
Can't you check the settings.url? $(document).ready(function(){ $(document).ajaxSend(function(event, request, settings){ if(settings.url != 'faceboxurl') // replace faceboxurl with the real url { $('body div.container').fadeTo('normal', 0.33); $('#loading').show(); } }); $(document).ajaxComplete(function(event, request, settings){ if(settings.url != 'faceboxurl') // replace faceboxurl with the real url { $('body div.container').fadeTo('normal', 1); $('#loading').hide(); } }); }); On Jul 24, 6:05 am, Rodrigo Tassinari rodr...@pittlandia.net wrote: Anyone? On 20 jul, 12:34, Rodrigo Tassinari de Oliveira rodr...@pittlandia.net wrote: Hello everyone, I'm stuck with an annoying problem in this webapp I'm developing. I've created a small code to be called automagically on every ajax request, which shows a loading... div overlay while the ajax request is being processed. This works fine, and the code used can be seen in this pastie: http://pastie.org/552179 However, we also use the Facebox plugin (http://famspam.com/facebox/) in this app, and we don't want the loading... div overlay to show when a facebox ajax request is triggered (the example link trigger is also on the above pastie), since facebox has it's on loading thing. I can't seem to do that. I binding the ajaxSend and ajaxComplete callbacks to some css selector that would include everything except the facebox links (a[rel*=facebox]), instead of the current $ (document) route, but I failed. Does anyone have any ideas to help me with this? Thanks a lot in advance, Rodrigo.
[jQuery] Re: [validate]
Validation is triggerd by 4 events that are active by default: Submit KeyUp Change Click -- for check box and radio button To prevent KeyDown and LostFocus validation use the following options onkeyup:false, onfocusout:false, onclick:false This information is available on the validate options doc. http://docs.jquery.com/Plugins/Validation/validate#toptions So, unless you are disabling the change event, your select should be re-validated on change event. Could you post your code? On Jul 24, 2:56 am, dustin.c dustin.chester...@gmail.com wrote: Hi all, I'm using the jQuery validate plugin. When select boxes don't pass validation, I want them to to be revalidated onChange. I don't see an option for this in the validate() options. Do I have to add it manually to the elements onchange attribute? -Dustin
[jQuery] Re: Need help with a custom selector to bind ajax callbacks
Opps, Sorry, didn't realise request and settings are not available on ajaxSend and ajaxStop. So, my proposed solution is not working. May be a dumber solution var isFaceBox = true; $(document).ready(function(){ $(document).ajaxSend(function(event){ if(!isFaceBox) { $('body div.container').fadeTo('normal', 0.33); $('#loading').show(); } }); $(document).ajaxComplete(function(event){ if(!isFaceBox) { $('body div.container').fadeTo('normal', 1); $('#loading').hide(); } }); $.ajax({ //your call beforeSend: function(){ isFaceBox = false;}, complete: function(){ isFaceBox = true;} }); }); On Jul 24, 10:02 am, Jules jwira...@gmail.com wrote: Can't you check the settings.url? $(document).ready(function(){ $(document).ajaxSend(function(event, request, settings){ if(settings.url != 'faceboxurl') // replace faceboxurl with the real url { $('body div.container').fadeTo('normal', 0.33); $('#loading').show(); } }); $(document).ajaxComplete(function(event, request, settings){ if(settings.url != 'faceboxurl') // replace faceboxurl with the real url { $('body div.container').fadeTo('normal', 1); $('#loading').hide(); } }); }); On Jul 24, 6:05 am, Rodrigo Tassinari rodr...@pittlandia.net wrote: Anyone? On 20 jul, 12:34, Rodrigo Tassinari de Oliveira rodr...@pittlandia.net wrote: Hello everyone, I'm stuck with an annoying problem in this webapp I'm developing. I've created a small code to be called automagically on every ajax request, which shows a loading... div overlay while the ajax request is being processed. This works fine, and the code used can be seen in this pastie: http://pastie.org/552179 However, we also use the Facebox plugin (http://famspam.com/facebox/) in this app, and we don't want the loading... div overlay to show when a facebox ajax request is triggered (the example link trigger is also on the above pastie), since facebox has it's on loading thing. I can't seem to do that. I binding the ajaxSend and ajaxComplete callbacks to some css selector that would include everything except the facebox links (a[rel*=facebox]), instead of the current $ (document) route, but I failed. Does anyone have any ideas to help me with this? Thanks a lot in advance, Rodrigo.
[jQuery] Re: extend an Object
Something like this? function person(name, address) { this.name = name; this.address = address; this.whoAmI = function() { if (this.creditLimit) alert(this.name + ' address:' + this.address + 'credit limit:' + this.creditLimit); else alert(this.name + ' address:' + this.address); } return this; } function customer() { this.creditLimit = 0; this.creditCheck = creditCheck; return this; function creditCheck() { alert(this.creditLimit); } } var a = new person('john smith', '10 main st'); var cust = new customer(); a.whoAmI(); $.extend(a, cust); a.creditLimit = 1000; a.whoAmI(); On Jul 22, 10:02 pm, jeanluca lca...@gmail.com wrote: Hi All I tried to add functions to an object like function User(n, a) { this.name = n ; this.aux = a ; } function auxis() { alert(this.aux); } $(document).ready( function() { var u = new User(Jack) ; u.extend({ whoami: function() { alert(this.name); }, autis: auxis }) ; u.whoami() ; }) ; Eventually I will have 2 object A and B and I want to merge A into B: B.exend(A) ; However it doesn't work at all. Any suggestions how to fix this ?
[jQuery] Re: Jquery Validation How To
The validation is only triggered during submit event which is fine to me. I don't like interactive validation as it creates distraction to the users. $(form).validate( { errorLabelContainer: #errMsg, wrapper: li }); $(#phoneCount).rules(add, { min: 1, messages: { min: 'A contact number is required.' } }); $(#business, #fax, #cell, #home).change(function() { if ($(this).val() != '') changeCounter(this,1); else changeCounter(this,-1); }); }); function changeCounter(calleer, i) { var curVal = parseInt($(#phoneCount)[0].value,10); $(#phoneCount)[0].value = curVal + i; } input type=hidden id=phoneCount name=phoneCount value=0 / div labelBusiness:/labelinput type=text id=business name=business /br / labelHome:/labelinput type=text id=home name=home / br / labelCell:/labelinput type=text id=cell name=cell / br / labelFax:/labelinput type=text id=fax name=fax / br / /div input type=submit id=btnSubmit name=btnSubmit value=Submit / On Jul 23, 3:19 am, kmac lucie.friga...@gmail.com wrote: Hi, I have a form that includes four text fields for phone numbers: Business, Home, Cell and Fax A user must fill in at least one phone number. How would I set up the validation for this? Cheers
[jQuery] Re: jQuery validation custom method doesn't work
Your code should have been: $.validator.addMethod('myEqual', function (value, element, param) { return value = $(param).val(); // this works know }, 'Please enter a greater year!'); On Jul 23, 12:21 pm, Erwin Purnomo panda...@gmail.com wrote: Hello all I have added a method on jQuery validator like this $.validator.addMethod('myEqual', function (value, element) { return value == element.value; // this one here didn't work :( }, 'Please enter a greater year!'); $.metadata.setType(attr, validate); $(#educationForm).validate({ showErrors: function(errorMap, errorList) { this.defaultShowErrors(); }, errorPlacement: function(error, element) { error.appendTo( element.parent(td).next (td) ); }, /*success: function(label) { label.text(ok!).addClass(success); },*/ rules: { txt_end: { required: true, myEqual: #txt_begin } }, submitHandler: function() { } }); the form looks like this div id=wrapper_form form id=educationForm name=educationForm method=post action= table width=500 border=0 tr td width=100Period:/td td width=200input type=text name=txt_begin id=txt_begin size=8 maxlength=4 class=required year ui-widget- content ui-corner-all / to input type=text name=txt_end id=txt_end size=8 maxlength=4 class=required year ui-widget-content ui-corner-all //td td width=200/td /tr tr td colspan=2 input type=submit name=btn_submit id=btn_submit value=Submit class=ui-button ui-state-default ui-corner-all / input type=button name=btn_cancel id=btn_cancel value=Cancel class=ui-button ui-state-default ui-corner-all / /td td /td /tr /table /form /div but why the custom method I added didn't work? return value == element.value; // this one here didn't work :( it always return true for any value :( am I missing something here? I didn't use the built in method because later in the form I would require to write another method to check for greater or equal and lower or equal ( = and = ) I have tested this method with greater or equal and lower or equal by replacing the == with = or with = It didn't work either
[jQuery] Re: Customize Error Labels
Read errorPlacement on validate docs. $(document).ready(function() { $(form).validate({ errorPlacement: function(error, element) { $(element).prev().addClass(error); } }); }); labelInput:/labelinput type=text id=txtInput name=txtInput class=required / On Jul 23, 3:03 pm, Rizky br4inwas...@gmail.com wrote: Hi, I need help with the Validation plugin. I want to disable the generated error labels and I need to find a way to add the class error to existing form labels instead. Currently I don't use it and simply want to add highlighting to the existing fields and labels. My forms already contain fields with corresponding labels (using the basic for - id relationship). And all i need to do now is to add the class error to these labels if the corresponding fields has errors. Sorry if this question have been asked before. Thx
[jQuery] Re: jquery.ajax executes error function for Web Server HTTP 201 Response
201 is considered as a success. It could be an error somewhere else, try to step through httpSuccess function. // Determines if an XMLHttpRequest was successful or not httpSuccess: function( xhr ) { try { // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status location.protocol == file: || ( xhr.status = 200 xhr.status 300 ) || xhr.status == 304 || xhr.status == 1223; } catch(e){} return false; } On Jul 21, 2:42 pm, Nitin nitins.shu...@gmail.com wrote: Hello, I am using jquery.ajax() to make a POST call to web server which returns HTTP 201 response for successful creation of object at server. Since 201 is a success I expect the success function specified with jquery.ajax to execute but instead it executes the error function specified with jquery.ajax. Here is how I am using jquery.ajax call. request = 'usernameSomeName/name/user'; $.ajax({ error:function(request) { alert('Error creating user'); }, success:function(xml, textStatus) { alert('success'); }, type: 'POST', contentType: 'application/xml;charset=UTF-8', url: server_root + '/management/users/', data: request }); Does success function gets executed only for HTTP 200 Response or will it be executed for HTTP 201 Response too? In case success function gets executed only for 200 response, how can I handle 201 response which is a success response? Any help to resolve above issue is appreciated. Thanks, Regards, Nitin
[jQuery] Re: Caching jQuery objects
I found out that jquery.validate code uses the form object to store global variables. Taking clue from the code, I uses the document object $.data($(document)[0], 'myData', myData). Not sure if this is the best practice, may be others can shed some light to the best practice to store global variables. On Jul 21, 8:51 pm, north ollo...@web.de wrote: Hi, I just created a little widget using jQuery. The code is kinda ugly, but I'm trying to improve it at least a bit. The first thing I wanted to do was to cache the jQuery objects. In this case I created global variables for this. Besides the global variables, I have a couple of functions using live to bind a handler to an mousedown or click event. Now, when trying to use the variables in those functions I recognized two effects: 1. Trying to apply .attr('disabled': true) to one of the cached objects doesn't work, while applying other attributes seems to work fine. 2. When defining a new variable in one of the functions, and trying to use one of the global ones in it, it also doesn't seem to work (something like this: var seriesAjaxOptions = $seriesAjax.html(); - $seriesAjax being a cached object). Any idea what's going on (or what could be going on) here? Thanks!
[jQuery] Re: Noob question about wrapped sets
$(#myElement) returns jQuery object and $(#myElement)[0] returns DHTML object. Here is a sample on how to access alt attribute jQuery $(#myElement).attr(alt) vs DHTML $(#myElement)[0].alt Both code return the same value. Correct me if i am wrong, I think the DHTML version is faster than the jQuery one. On Jul 21, 8:07 am, nyte999 zend...@gmail.com wrote: Going through the tutorials on this website and others, I've found some syntax that I don't understand and is never explained. Usually wrapped sets look like this: $(#myElement) But once in a while they look like this $(#myElement)[0] Here are a few examples of it in use: $(div).index($(div#myDiv)[0]); $(#myImage)[0].alt; I don't get it. The sample code is NEVER trying to find the first element of an array. From my POV this format seems completely random and unnecessary, yet the jQuery code will NOT work if the [0] is removed. I know it's something glaringly obvious and I'll feel stupid when I get the answer, but my god, I just can't figure out the pattern here. Please help.
[jQuery] Re: Validation plugin - submit form without validation
Try $(#frm)[0].submit() On Jul 20, 1:56 pm, Adam P aploc...@gmail.com wrote: I'm using the Validation plugin for JQuery and was wondering if there was a function to submit the form without causing it to validate the form. I have a table with a list of radio-buttons and above that is a drop down list of states. The drop down list of states is used to filter the table rows and when the selected item changes it posts-back to the server (via $(#frm).submit()). I don't want this to cause any validation to occur. Is there another function I can call besides submit(), or some other method? Thanks
[jQuery] Re: Value adding to drop down
OK that means the values causing the problem. Are your strings stored in the database as double byte characters? Try to view your page in Firefox and use firebug to display the value instead of using alert (). On Jul 20, 2:08 pm, naz s.na...@gmail.com wrote: i have values in data like BSIT|MSIT|BSC| etc when i used alert(). to display data values then values are correct but when values appear in drop down they become |BSIT code is like this var programs=[]; alert(data); programs=data.split('|'); $('#p_course').length = 1; for(var i=0;iprograms.length-1;i++) { var objDropdown =$('#p_course').get(0); var objOption = new Option(programs[i],programs[i]);// adding option objDropdown.options[objDropdown.length] = objOption; } actually i m storing these values in data from db may be thats why there is a problem bcs when i use static value then it appear correctly. If u can understand whts gng on plz tell me thnx alot On Jul 18, 12:55 pm, Theodore Ni zyl...@gmail.com wrote: Please post again your current jQuery code including the separator you are using, as well as what is inside the data variable in full. That way, we can understand exactly what's going on; right now, I'm still confused. Teddy On Sat, Jul 18, 2009 at 12:07 AM, naz s.na...@gmail.com wrote: i have changed '|' seperator still it is not working.:( On Jul 16, 10:31 am, 刘永杰 liuyongjie...@gmail.com wrote: change split character,not use '|'. 2009/7/16 naz s.na...@gmail.com hi i m adding some values to drop down by usind j query by this code var programs=[]; programs=data.split('|'); $('#p_course').length = 1; for(var i=0;iprograms.length-1;i++) { var objDropdown =$('#p_course').get(0); var objOption = new Option(programs[i],programs[i]); objDropdown.options[objDropdown.length] = objOption; } but when vales appear in drop down first value look like this |BSIT any body have any idea why it look like this- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[jQuery] Re: Value adding to drop down
I tested your code with the following data var data = 'program1|program2|program3|'; and the drop down combo box displays program1 program2 program3 correctly. Again could you post the value of your data? On Jul 18, 2:07 pm, naz s.na...@gmail.com wrote: i m using internet explorar.and data value is SE,DLD etc i m getting these values from db. On Jul 16, 11:14 am, Jules jwira...@gmail.com wrote: The code looks fine to me. Could you post the data value? What is the browser you are using? On Jul 16, 2:58 pm, naz s.na...@gmail.com wrote: hi i m adding some values to drop down by usind j query by this code var programs=[]; programs=data.split('|'); $('#p_course').length = 1; for(var i=0;iprograms.length-1;i++) { var objDropdown =$('#p_course').get(0); var objOption = new Option(programs[i],programs[i]); objDropdown.options[objDropdown.length] = objOption; } but when vales appear in drop down first value look like this |BSIT any body have any idea why it look like this- Hide quoted text - - Show quoted text -
[jQuery] Re: Value adding to drop down
The code looks fine to me. Could you post the data value? What is the browser you are using? On Jul 16, 2:58 pm, naz s.na...@gmail.com wrote: hi i m adding some values to drop down by usind j query by this code var programs=[]; programs=data.split('|'); $('#p_course').length = 1; for(var i=0;iprograms.length-1;i++) { var objDropdown =$('#p_course').get(0); var objOption = new Option(programs[i],programs[i]); objDropdown.options[objDropdown.length] = objOption; } but when vales appear in drop down first value look like this |BSIT any body have any idea why it look like this
[jQuery] Re: Can this plugin be structured better?
May be something like this? (function($) { $.fn.editable = function(options) { var defaults = { // default value declarations } var opts = $.extend(defaults, options); return this.each(function() { var $this = $(this); // Cache a jQuery version of this var tag = $this.get(0).tagName; var obj; this.doSomething = obj.doSomething; switch (tag) { case 'DIV': obj = new $.myDiv(); obj.init(); break; case 'IMG': obj = new $.myImg(); obj.init(); break; } }); } })(jQuery); jQuery.myImg = function() { { this.init = initImg; this.doSomething = imgFunction; return this; function initImg() { } function imgFunction() { } } jQuery.myDiv= function() { this.init = initDiv; this.doSomething = divFunction; return this; function initDiv() { } function divFunction() { } } On Jul 12, 6:37 pm, Harvey scottandrewhar...@gmail.com wrote: Hey, I'm in the process of developing a new plugin but the way I have structured the codes doesn't seem quite right to me so I'm hoping someone might be able to offer a better way to do it. The plugin itself has different behaviour if called on different types of elements (images, divs etc) with a range of shared functions used across all element types. This is the basic structure I have so far: (function ($) { $.fn.editable = function (options) { var defaults = { // default value declarations } var opts = $.extend(defaults, options); return this.each(function () { var $this = $(this); // Cache a jQuery version of this var tag = $this.get(0).tagName; switch(tag) { case 'DIV': initDiv(); break; case 'IMG': initImage(); break; } function initDiv () { // initialise the plugin to work with divs } function initImage () { // initialise the plugin to work with images } // functions used by divs only function divFunction () { // body... } // functions used by images only function imageFunction () { // body... } // functions used by divs and images function sharedFunction () { // body... } }); } })(jQuery); The reason it does seem right to me is because any instance of the plugin called on a div will also contain all the code that is used if it was an image even though the code won't be used. Can any offer something better?
[jQuery] Re: Can this plugin be structured better?
In the object init, pass this. switch (tag) { case 'DIV': obj = new $.myDiv(); obj.init ($this);break; jQuery.myDiv= function() { this.init = initDiv; this.doSomething = divFunction; this.actualObject; return this; function initDiv(obj) { this.acutalObject = obj; } function divFunction() { // call shared function $.sharedDoSomething(); } } jQuery.sharedDoSomething = function() { } Hope that make sense. On Jul 16, 4:38 pm, Harvey scottandrewhar...@gmail.com wrote: I did think of that solution but where would I put functions shared by myImg and myDiv that need access to the $this and tag variables?
[jQuery] Re: manipulate the next element with a class
It should be siblings() not find(). On Jul 16, 8:00 am, Benn bennmey...@gmail.com wrote: Is there a non-structure specific way of finding the next element with a given class? for example you have a structure of: div id=container1 a href=# class=link1link/a div class=a1asdf/div /div!-- #container1 -- div id=container2 a href=# class=link1link/a div class=a1ghjl/div /div!-- #container2 -- div id=container3 a href=# class=link1link/a div class=a1qwer/div /div!-- #container3 -- When you click on the link in container1 the expected behavior is to change the css on a1 in container2 but not in container1 or container3. I have tried playing with parent, next and filter without success. this is the best I have is: $(document).ready(function(){ $(.link1).click(function(){ $(.a1).css({visibility:hidden}); //hides all a1's but keeps the space }); });
[jQuery] Re: manipulate the next element with a class
Opps, after re-reading the original post it should be $(this).parent().next().find(.a1).css({ visibility: hidden }); However, this only works for #container1 .link1 and #container2 .link1. If you click #container3 .link1, nothing happens. On Jul 16, 10:24 am, Jules jwira...@gmail.com wrote: It should be siblings() not find(). On Jul 16, 8:00 am, Benn bennmey...@gmail.com wrote: Is there a non-structure specific way of finding the next element with a given class? for example you have a structure of: div id=container1 a href=# class=link1link/a div class=a1asdf/div /div!-- #container1 -- div id=container2 a href=# class=link1link/a div class=a1ghjl/div /div!-- #container2 -- div id=container3 a href=# class=link1link/a div class=a1qwer/div /div!-- #container3 -- When you click on the link in container1 the expected behavior is to change the css on a1 in container2 but not in container1 or container3. I have tried playing with parent, next and filter without success. this is the best I have is: $(document).ready(function(){ $(.link1).click(function(){ $(.a1).css({visibility:hidden}); //hides all a1's but keeps the space }); });
[jQuery] Re: (validate) Validating multiple drop down boxes
I had simillar problem to this. The solution is a little bit clumsy but it works. --SCRIPT $(document).ready(function() { $(#inputForm).validate({ errorLabelContainer: #errorContainer, wrapper: li }); $(#MOB).change(function() { if ($(this).val() == ) $(#hidDOB).val($(#hidDOB).val() 5); else $(#hidDOB).val($(#hidDOB).val() | 2); }); $(#DOB).change(function() { if ($(this).val() == ) $(#hidDOB).val($(#hidDOB).val() 6); else $(#hidDOB).val($(#hidDOB).val() | 1); }); $(#YOB).change(function() { if ($(this).val() == ) $(#hidDOB).val($(#hidDOB).val() 3); else $(#hidDOB).val($(#hidDOB).val() | 4); }); $(#hidDOB).rules(add, { min: 7, messages: { min:Incomplete birthdate. } }); --HTML div id=errorContainer style=display:none /div form id=inputForm action=selectobject.htm input type=submit id=clickme value=Click Me / input type=hidden id=hidDOB value=0 / label for=MOB id=lblDOB Date of Birth/labelbr / select id=MOB name=MOB option value= selected=selectedMonth/option option value=2January/option /select select id=DOB name=DOB option value= selected=selectedDay/option option value=202/option /select select id=YOB name=YOB option value= selected=selectedYear/option option value=19061906/option option value=1907etc. etc./option /select /form On Jul 16, 8:06 am, mgs msi...@gmail.com wrote: Hi All, I need to check that a user's birthday has been filled out completely, using drop down menus. I can validate each of the menus individually (see code below), but what i really want to do is make one check that all three are selected so that I don't have 3 extra error labels... Any suggestions? $(document).ready(function(){ $(#form1).validate({ rules: { MOB: required , DOB: required, YOB: required }, messages: { MOB: Need a month, DOB: Need a Day, YOB: Need a year, } )}; )}; html label for=MOB id=lblDOBDate of Birth/labelbr / select id=MOB name=MOB option value= selected=selectedMonth/option option value=2January/option /select select id=DOB name=DOB option value= selected=selectedDay/option option value=202/option /select select id=YOB name=YOB option value= selected=selectedYear/option option value=19061906/option option value=1907etc. etc./option /select /html
[jQuery] Re: Inserting LI elements
If you want to be sure the is appended after the last li use this $(.list li:last).after(liitem + (parseInt($(.list li).length,10) + 1) + /li); On Jul 15, 10:24 am, Eno symb...@gmail.com wrote: Given this HTML: ul class=listliitem 1/li/ul How would I insert lI elements inside the ul element after the existing li? I tried using append() but that created a second ul element with the new elements inside it after the existing ul block. --
[jQuery] Re: Validate textbox (required=true) on combobox selected value
Its in the validate documentation http://docs.jquery.com/Plugins/Validation/Methods/required#dependency-expression In your case rules: { newColor: { required: function(element) { return $(#color).val() == -1; } } On Jun 24, 10:52 pm, ciupaz luigi.zambe...@gmail.com wrote: Hi all, I have to validate a textbox if the user select a particular value in a combobox. For example, if the user select the Specify new color in the following combobox: select id=color name=color option value=-1Specify new color/option option value=1Red/option option value=2Green/option option value=3Blue/option option value=4White/option option value=5Black/option /select I have to validate the following textbox: input id=newColor name=newColor type=text / with the Validate Plugin: rules: { newColor: { required: ?? }, How can I accomplish this? Thanks in advance. Luis.
[jQuery] [validate] Validating a formatted number failed
Hi all, I am using validate (1.5.4) plugin to validate numeric input field with max:5000.00. When the numeric value is formatted as 2,999.00, the max validation failed. After some investigation, it turns out the max function compare the value 2,999.00 as string with 5000.00 instead of 2999.00 with 5000.00. To fix this, I modified the existing value variable with parseFloat(value.replace(,,) in min:, max:, and range:. Note: Only works in countries that use , as thousand separator. For Jörn, could this fix be included on your future release? Thanks.
[jQuery] Triggering asp:Button click event from client side
Hi, I have a page with an asp:Button save that performs an ajax validation before post back. If the data is incorrect, the aspx returns a warning text message. The user can ignore the warning and continue to save the data. I managed to perform the desired result using the posted code below. Notice that the button click event is called 2 times first when the user trigger the event, then the 2nd time by target.click() after setting the doCheck and response values. I am not happy with the code. Is there any other way to replace target.click() with some thing which by pass the validation again? var doCheck = true; var response = true; $(document).ready(function() { $(input[name$='ajaxConfirm']).bind(click, function(e) { var target = $(e.target); if (doCheck) { $.get(GetConfirmation.aspx, { param1: test, param2: data }, function(result) { if (result != ) { response = confirm(result); } doCheck = false; target.click(); //replace this } , text); e.preventDefault(); } else { if (!response) e.preventDefault(); doCheck = true; response = true; } }); -- Generated asp:Button input type=submit name=ctl00$conMain$ajaxConfirm value=Ajax Confirm id=ctl00_conMain_ajaxConfirm /