[jQuery] Re: Resetting the reset button
i dont think you can do thatyou probably have to cache your state yourself i think reset uses the defaultValue attribute of the input and i think the attribute is readonly. correct me if i am wrong
[jQuery] jcarousel sorgalla.com auto circular
Hi everyone, I have problem with set up jcarousel with jquery 1.3. I need the auto circular one jQuery('#mycarousel').jcarousel({ wrap: 'circular', auto: 2 }); but behavior of carousel is vague. In init the first item appears correctly, and the width of container is ok(I think it is - has about width for every item in line - if item has 30px the we have two items container has 60px). But after two seconds the first and second item slide fast to the left from carousel display field. The effect is I can see only background beneth carousel display area(items are away). It's strange becouse with wrap like: 'last' the carousel works fine. What I do wrong? Thanks in advance.
[jQuery] Re: Resetting the reset button
On May 1, 1:49 am, russellneufeld russellneuf...@gmail.com wrote: Hi all, I've got a set of forms which all act the same way - the form submit is handled by the jQuery form plugin which redirects the output to a div on the page. That means that when the user hits submit, the page in the browser doesn't change. The success or failure of the form submit is displayed on the existing page. The pages all have a submit and a reset button. The issue is that the reset button holds the state of the form when the page was originally sent to the browser. Only if you do that yourself, normally the reset button effectively does nothing more than call the reset method of the form. That means that after someone changes the form and submits it successfully, the reset button returns the form to the previous state when the page was originally sent to the browser. But that state doesn't really reflect the current state of the form variables (as held on the server) since an update has been made. Form controls have either a defaultValue, defaultChecked or defaultSelected property, depending on the type of element, that holds the default value of the control. When the form is reset, the control's value is reset to the relevant default. My question is this - is there a way to update the reset button so that it resets the form to a new state, one that might have changed since the browser originally rendered the page? Change the default[Value|Checked|Selected] property to whatever you want, then the reset button will reset to that value. URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-26091157 URL: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-37770574 -- Rob
[jQuery] refresh image?
Hi, after sending a form, I would like to reload the form in order to send a new message. Therefore I was resetting the old form, but I need to call a new captch image. It's currently like this: img src=inc/captcha/captcha.php id=captcha alt= border=0 style=float:left; / I thought I coud re-load it with: $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php); But this way I don't get a new call... to generate a new image and with it connected a new session entry for the captcha code. What can I do to create a real call to the file? Any ideas? Thanks Heidi
[jQuery] Re: is next() recursive?
Hi, Your code is missing th /ul for ul id=second When I add this in everything toggles as expected -- http://jsbin.com/esaso/edit Paul On May 6, 3:37 am, brian bally.z...@gmail.com wrote: jquery 1.3.2 I have a nested group of lists similar to below where all but the top-level list is hidden. Clicking a link should open the next level (as well as do some AJAX stuff). I'm having some trouble getting the 2nd level to open without also opening the 3rd level when clicking on a top-level link. (The IDs are here clarity) ul id=first li class=Section a href=.../a ul id=second li a href=.../a /li li a href=.../a ul id=third li a href=.../a /li li a href=.../a /li /li /ul /li li class=Section ... /li /ul My code closes the lists on load like so: $('#nav li.Section ul').hide(); This line, in the click handler, opens the next nav if there is one inside the clicked anchor's list item: $(this).next('ul').toggle('slow'); However, it's also opening the 3rd level when clicking an anchor at the top level. From my reading of the API, next('ul') should only be returning the 2nd level UL. Am I misunderstanding? Is there a better way to grab only the *very next* ul?
[jQuery] Re: refresh image?
could you .load() the image into a container? On May 6, 10:46 am, heohni heidi.anselstet...@consultingteam.de wrote: Hi, after sending a form, I would like to reload the form in order to send a new message. Therefore I was resetting the old form, but I need to call a new captch image. It's currently like this: img src=inc/captcha/captcha.php id=captcha alt= border=0 style=float:left; / I thought I coud re-load it with: $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php); But this way I don't get a new call... to generate a new image and with it connected a new session entry for the captcha code. What can I do to create a real call to the file? Any ideas? Thanks Heidi
[jQuery] Re: refresh image?
depending whether it tries to pull the existing image from the user's temp.internet files or not, you may also want to add a random number onto the request to prevent IE from caching the previous request. On May 6, 12:03 pm, ryan.j ryan.joyce...@googlemail.com wrote: could you .load() the image into a container? On May 6, 10:46 am, heohni heidi.anselstet...@consultingteam.de wrote: Hi, after sending a form, I would like to reload the form in order to send a new message. Therefore I was resetting the old form, but I need to call a new captch image. It's currently like this: img src=inc/captcha/captcha.php id=captcha alt= border=0 style=float:left; / I thought I coud re-load it with: $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php); But this way I don't get a new call... to generate a new image and with it connected a new session entry for the captcha code. What can I do to create a real call to the file? Any ideas? Thanks Heidi
[jQuery] BEdita - semantic content management framework that uses jQuery
Hi, after more than 2 years of hard/heavy work we are really pleased to announce the first public beta release of BEdita 3 (pronounced [bi'εdita]), a semantic content management framework that uses jQuery. http://www.bedita.com http://www.bedita.com/beopen [our website is still work in progress, some english translations still missing...sorry] BEdita is not a real CMS (in fact it's a framework), but aims to be a standard Web2/3 publishing platform...there are really a lot of things that I could tell you about the project (which is really big and ambitious)... but I don't want to bother you.. so I stop here ;-) We just want to thank the jQuery developers and community for such a great tool! Thank you, really. Here a brief list of technologies and features for the curious. We would like to hear comments/suggestions from you. Requirements * PHP = 5.2, Mysql = 5.0.26 (stored procedures and views), Apache2, shell access Third party components/libraries (bundled) * CakePHP = 1.2 * Smarty = 2.6 * JQuery = 1.2 * phpThumb, TinyMCE,... Licensing * Affero GPL v3 * Commercial/proprietary Key Features * powerful/advanced backend web application to create/handle contents, with some innovative UI design ideas; * frontend API to easily build your own frontend applications (backend and frontends are different applications) * object oriented design: every type of content (documents, news, events, videos, images, newsletters, vcards,...) is an object that can be tagged, commented, published, categorized * modular design: specific software modules for different tasks and content types (multimedia, events, news, administration, publishing, addressbook, newsletter,...) * complete internationalization: user interface contents, specialized module for translators * ability to create free semantic relations between contents * every object has a unique nickname (friendly URLs and friendly name to access each resource) * native XML/REST interface * and many others... bye Alberto Pagliarini (aka bato) --- Channelweb srl http://www.channelweb.it
[jQuery] efficient way to find a parent
I want to find a parent for a button. I have set up the html like the following. div id='user_123' class='user' h1My name goes here/h1 psome description/p a href='Javascript:{}' class='select' /div The thing is that I need to specify how many steps I have to go up to get the parent id( see the bottom ) and if I add another tag I migh have to change this source. Is there any way to specify using class ( maybe $(this).parent(.user).attr(id) ?) so that I don't need to specify how many level I have to go up in order to get that id? $().ready(function(){ $(.select).click(function(){ alert($(this).parent().attr(id)); }); }); Thanks in advance.
[jQuery] Getting the text of an element: IE6 vs. FF3
I have some HTML: a href=# class=linksLink One/abr / a href=# class=linksLink Two/abr / a href=# class=linksLink Three/abr / And the following JQuery JS to test the onclick handler $(.links).click(function(){ alert( this.text - + this.text + \n + //above returns undefined in IE 6 this.childNodes[0].data - + this.childNodes [0].data + \n //returns expected text in FF and IE 6 ); Why does this.text work fine with FF but I need something more convoluted like this.childNodes[0].data to get it to work in IE6? I thought that JQuery shielded me from these wacky cross-browser issues
[jQuery] Disable checkbox
Hi all, using jQuery.Validate plug-in, how can I disable a checkbox when the user check another checkbox in the form? Thanks in advance. Luigi
[jQuery] Is it possiblwe to use this in slection
Hi all, I wanted to ask whether we can use this for selecting in jquery. What i want to do is to have one toggle function for many objects. the fuction i use now is the above $('a#slick-toggle').click(function() { $('#slickbox').toggle(400); return false; }); which toggles the slickbox when the slick-toggle is clicked. The problem that i have is that i want to have many objects like slick- toggle1 slickbox1, slick-toggle2 slickbox2. One way is to make different function for each a, but because the html is created dynamically, i don't know from the beggining how many i will have. So what i ask how i can do something like that $('a').click(function() { $('#slickbox+this.id').toggle(400); return false; }); where this.id is going to be the id of the a i click and #slickbox +this.id is the id of the object i want to hide. Christos
[jQuery] Re: Using Tablesorter with ajax generated tables
I'm having a similar problem with my site I'm loading a table like this: body onload=setTimeout('changeBalanceTable();',100); The changeBalanceTable() function simply inserts a table from a php script into a div using .innerHTML = TABLE Since my table loads after 100ms how do I set my TableSorter to sort it since the table is not in the DOM tree initially. I tried using setTimeout and then calling tableSorter, but that didn't work for me. Thanks for any suggestions. Evan
[jQuery] image changes when mouse over a link
I am looking for a effect. There are 3 images and 3 links at the bottom. when mouse over a link should change the image. I tried all the possible searches but could not get the desired tutorial. any help?? thanks..
[jQuery] Strange problem getting width/height
Hello to everybody, I'm writing you since I'm getting a strange problem with getting height/width of a div I've inserted with div.html (data); Ive got this HTML : div id=rootDiv style=border: 1px solid #BAD3E0; visibility: hidden; div id=content /div div id=navigation style=width: 20%; text-align: left; display: block; div id=prevButton style=margin: 0px 2px 2px 2px; float:left; img src=images/prev.jpg id=imgPrev alt=prev // div div id=nextButton style=margin: 2px; img src=images/next.jpg id=imgNext alt=next // div /div /div I need to autoresize the rootDiv at the size of the div('#content') Here's the javascript: var currentPage = 0; var maxPage = 0; var idDIV = DIV_ID; var args = { 'lang': lang, 'keyword': keyword, 'servicename': servicename, 'size': size, 'sourceSite': sourceSite, 'showSuggested': showSuggested, 'action': action }; var xhr = $.post(url, args, function(data) { var div = $('#content'); div.html(data); currentPage = xhr.getResponseHeader('currentPage'); maxPage = xhr.getResponseHeader('maxPage'); (*) $(document).oneTime(2000, function(data) { var iframe = div.find('#PanelRSSyahoo')[0]; if (iframe != null) { $('#rootDiv').css('width', iframe.clientWidth); $('#rootDiv').css('visibility', 'visible'); if (currentPage == 0) $('#prevButton').css('visibility', 'hidden'); else $('#prevButton').css('visibility', 'visible'); if (currentPage == maxPage) $('#nextButton').css('visibility', 'hidden'); else $('#nextButton').css('visibility', 'visible'); } }); }); I had to insert the oneTime function otherwise after the (*) I got the whole width size... it's as if the DOM refreshed after a little bit of time... but this cause the page to show up two seconds later... any suggestion?? Thanks in advance Paolo
[jQuery] smooth fadein() problem with iframes and div tags
Hi, I'm having a problem achieving smooth loading of iframes. My ideal behavior for the iframe is that iframe is completely loaded into the dom, and them when I call fadeIn, it smoothly fades in. Instead, I get a very choppy behavior. If I run a sequence like: fadeIn(), fadeOut(), fadeIn() - the first fadeIn is choppy, while the last fadeIn is smooth. This leads me to believe this has to do with how the element is added to the dom. Does anyone know how to solve this issue? code contentURL = 'www.facebook.com'; $('body').append('iframe id=myiframe/'); $('#myiframe').attr('src', contentURL).hide(); $('#myiframe').fadeIn('medium'); /code Thanks!
[jQuery] multiple selects put into an array is this easy?
hullo, I am new to js and jquery ... and have got into a mess trying to find a way to do this. I have a large table and I want to be able to select multiple entries from one column... using the usual ctrl and shift keys to either select continuous groups or multiple individual entries. So as the user selects more values they are added to an array( which will ultimately be sent via jquery json to a db ) I do not want to use the html select multiple and submit method because there are too many possible choices , , so jquery seemed the answer Any help gratefully received
[jQuery] recursive dom walker
I am trying to write a plugin that will eventually match a specific string pattern on the id attribute of all form element(s) I aim to get a collection of all elements that I want to return for chaining I generate a regular expression on the fly based on the arguments passed in and use this to find an initial set of elements I have this returning jquery objects using this $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) this also works $(:input).filter(function() { return $(this).attr(id).match(regEx); }).setDisabled(true); But when I use this $(#a_1).recurse({source:a_1}).setDisabled (true); ,my plugin function I get this TypeError: $(#a_1).recurse is not a function Its my first attempt at a plugin and I guess I am not returning the jquery object and I am not sure if this is the correct approach Anyway any advice would be much appreciated Full code below (function($) { $.recurse = function(options) { var defaults = { delimeter: _ , level: 1 , dir: down , source: body } var settings = $.extend({}, defaults, options); // funtion to find regEx function generateRegEx(delimeter, src, direction) { console.log(src.split(delimeter)); console.log(src.length); // need to have the concept of next and prev // so for prev or back take away a wholePattern match // and fro next or forward add a pattern match // so based on src and the up or down param var dir = direction arr = src.split(delimeter); var arrLength = arr.length; console.log(arrLength); if (arrLength = 1 direction == up) { //alert(the only way is forward); throw Error(you can only go up from here); direction = up; } arrLength = (direction == up) ? arrLength - 2 : arrLength; //^([0-9a-zA-Z-]+\_){3}$ - this gets all the pattern does ntot take account of src // supercedes the one above ^a_1(\_[0-9a-zA-Z-]+){2}$ var delPattern = src + (\\ + delimeter + [0-9a-zA-Z-] +); //this will match the character that separates the levels var numerOfPattern = { + arrLength + }; //this matches all alpha-numeric characters in between the delimeters var wholePattern = delPattern + numerOfPattern; // this combines them both console.log(wholePattern); var pattern = ^ pattern += wholePattern; pattern += $; console.log(pattern); return new RegExp(pattern); }; var regEx = generateRegEx(settings.delimeter, settings.source, settings.dir); $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) }; })(jQuery);
[jQuery] barackslideshow effect in jquery.
hi all..i am looking for a similar effect like the barackslideshow effect. can anyone suggest such a plugin in jquery. thanks a lot
[jQuery] remote validation
I'm trying to do a jquery remote validation on a 'Name' text field. The validation checks if the name is unique, hence it has to be done through the remote method. 'Save' button onclick is attached to this javascript method function validateName() { txtName.rules('add', { remote: { url: 'validate.ashx' , data: ({id: txtName.attr('name')}) } } , messages: { remote: '* Error' } }); var isNameValid = txtName.valid() return isNameValid; } The problem I have is that .valid() always returns false - because it doesn't wait for the remote validation GET to complete. Hence validation fails. Any suggestions? How do people normally do remote validation in jquery? Note: I know for sure that validate.ashx returns true. Thanks in advance.
[jQuery] Re: Disable checkbox
That doesn't need the validation plugin. jQuery can do this by itself: $(#first).click(function() { $(#other).attr(disabled, true); }); Jörn On Wed, May 6, 2009 at 11:37 AM, ciupaz luigi.zambe...@gmail.com wrote: Hi all, using jQuery.Validate plug-in, how can I disable a checkbox when the user check another checkbox in the form? Thanks in advance. Luigi
[jQuery] Re: Using Tablesorter with ajax generated tables
Put it at the end of the changeBalanceTable event On May 6, 2:36 am, Evan sicsempere...@gmail.com wrote: I'm having a similar problem with my site I'm loading a table like this: body onload=setTimeout('changeBalanceTable();',100); The changeBalanceTable() function simply inserts a table from a php script into a div using .innerHTML = TABLE Since my table loads after 100ms how do I set my TableSorter to sort it since the table is not in the DOM tree initially. I tried using setTimeout and then calling tableSorter, but that didn't work for me. Thanks for any suggestions. Evan
[jQuery] Re: remote validation
Not easy to solve - you could use $().ajaxStop() to wait for the request to finish, then you valid() again, this time it will validate the cached value and return the correct result. Jörn On Wed, May 6, 2009 at 8:00 AM, Mekilioz mekil...@gmail.com wrote: I'm trying to do a jquery remote validation on a 'Name' text field. The validation checks if the name is unique, hence it has to be done through the remote method. 'Save' button onclick is attached to this javascript method function validateName() { txtName.rules('add', { remote: { url: 'validate.ashx' , data: ({id: txtName.attr('name')}) } } , messages: { remote: '* Error' } }); var isNameValid = txtName.valid() return isNameValid; } The problem I have is that .valid() always returns false - because it doesn't wait for the remote validation GET to complete. Hence validation fails. Any suggestions? How do people normally do remote validation in jquery? Note: I know for sure that validate.ashx returns true. Thanks in advance.
[jQuery] Re: [autocomplete] Invoking autocomplete dropdown on focus, before user types
On 5/5/09 6:09 PM, Mike Harris gfunk...@gmail.com wrote: Does anyone know how I can get the autocomplete dropdown list of values to appear when the text field gains focus, before the user types anything. I've been trying to do this, and have so far been unsuccessful. Any help would be greatly appreciated. let me know if this works: $(selector).focus(function(){ $(this).setOptions({minChars: 0}).trigger('click').trigger('click'); } where selector selects your text field.
[jQuery] Re: [autocomplete] disable submit until valid selection is made
On 5/5/09 7:51 PM, Seth seth.ta...@gmail.com wrote: I have a situation where the only valid inputs on my autocomplete field are the ones supplied by my ajax method. Is there a way to disable the submit button on my form until the input field contains one of the autocomplete values? could you perhaps enable the submit button with result()? http://docs.jquery.com/Plugins/Autocomplete/result#handler
[jQuery] Re: How To Get Around: Access to restricted URI denied code: 1012
I won't be able to rewrite the service cause we also have cold fusion sites consuming the xml data. I guess I am stuck with creating another asp.net page that will call the service. Thanks for helping out everyone. On May 5, 9:16 pm, 丁亮 bluker2...@gmail.com wrote: use jsoncallback=? in the end of url
[jQuery] Re: Is it possiblwe to use this in slection
Yes, you can. this refers to the HTMLElement in the context of an event handler. Though, your syntax is a bit wonky, should be: $('#slickbox' + this.id).toggle(400); On May 6, 4:13 am, Christos tsam...@gmail.com wrote: Hi all, I wanted to ask whether we can use this for selecting in jquery. What i want to do is to have one toggle function for many objects. the fuction i use now is the above $('a#slick-toggle').click(function() { $('#slickbox').toggle(400); return false; }); which toggles the slickbox when the slick-toggle is clicked. The problem that i have is that i want to have many objects like slick- toggle1 slickbox1, slick-toggle2 slickbox2. One way is to make different function for each a, but because the html is created dynamically, i don't know from the beggining how many i will have. So what i ask how i can do something like that $('a').click(function() { $('#slickbox+this.id').toggle(400); return false; }); where this.id is going to be the id of the a i click and #slickbox +this.id is the id of the object i want to hide. Christos
[jQuery] Re: recursive dom walker
Your recurse function is not a method of the jQuery.fn object, so it can't work on elements. The line: $.recurse = function(options) { should be $.fn.recurse = function(options) { On May 6, 9:00 am, AndyCramb andycr...@googlemail.com wrote: I am trying to write a plugin that will eventually match a specific string pattern on the id attribute of all form element(s) I aim to get a collection of all elements that I want to return for chaining I generate a regular expression on the fly based on the arguments passed in and use this to find an initial set of elements I have this returning jquery objects using this $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) this also works $(:input).filter(function() { return $(this).attr(id).match(regEx); }).setDisabled(true); But when I use this $(#a_1).recurse({source:a_1}).setDisabled (true); ,my plugin function I get this TypeError: $(#a_1).recurse is not a function Its my first attempt at a plugin and I guess I am not returning the jquery object and I am not sure if this is the correct approach Anyway any advice would be much appreciated Full code below (function($) { $.recurse = function(options) { var defaults = { delimeter: _ , level: 1 , dir: down , source: body } var settings = $.extend({}, defaults, options); // funtion to find regEx function generateRegEx(delimeter, src, direction) { console.log(src.split(delimeter)); console.log(src.length); // need to have the concept of next and prev // so for prev or back take away a wholePattern match // and fro next or forward add a pattern match // so based on src and the up or down param var dir = direction arr = src.split(delimeter); var arrLength = arr.length; console.log(arrLength); if (arrLength = 1 direction == up) { //alert(the only way is forward); throw Error(you can only go up from here); direction = up; } arrLength = (direction == up) ? arrLength - 2 : arrLength; //^([0-9a-zA-Z-]+\_){3}$ - this gets all the pattern does ntot take account of src // supercedes the one above ^a_1(\_[0-9a-zA-Z-]+){2}$ var delPattern = src + (\\ + delimeter + [0-9a-zA-Z-] +); //this will match the character that separates the levels var numerOfPattern = { + arrLength + }; //this matches all alpha-numeric characters in between the delimeters var wholePattern = delPattern + numerOfPattern; // this combines them both console.log(wholePattern); var pattern = ^ pattern += wholePattern; pattern += $; console.log(pattern); return new RegExp(pattern); }; var regEx = generateRegEx(settings.delimeter, settings.source, settings.dir); $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) }; })(jQuery);
[jQuery] Disable input button, using wrong HTML code?
I created a test page here: http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this?
[jQuery] Re: 1.3.2 td class selector only picks the first td
Yeah, I've written a simple test myself in which everything works fine. However, in the case where it doesn't work, there's a lot of other code that might be causing problems. The table itself is inside a widget created using jQuery sortable, draggable, droppable, and resizable. Initially the widget content, including the table is hidden, then copied into the widget and shown, so there's a lot of other reasons why it might not work. On Apr 22, 9:21 pm, Shane Riley shanerileydoti...@gmail.com wrote: There's definitely nothing wrong with the JQuery. Can you post a test case so that we can see all of the pieces to the puzzle? On Apr 22, 7:07 pm, Richard D. Worth rdwo...@gmail.com wrote: Your code looks fine, and I wasn't able to reproduce what you're describing: http://jsbin.com/ucaqi - Richard On Wed, Apr 22, 2009 at 6:18 PM,kapeerlend.so...@gmail.com wrote: The following code worked fine in 1.2.6 but after upgrading to 1.3.2 only the first table cell is shown/hidden. table tr td class=morea/td td class=moreb/td td class=morec/td td class=mored/td /tr /table span id=moreLessmore/span ... jQuery('#moreLess').click(function() { if(jQuery(this).text() == 'more') { jQuery(this).text('less'); jQuery('.more').show(); } else { jQuery(this).text('more'); jQuery('.more').hide(); } }); Version 1.2.6 used to add style=display: none; when hiding, and would remove it when showing. Version 1.3.2 adds toggles between style=display: none; and style=display: table-cell;. I don't think that matters really, what does matter however is that if I alert jQuery('.more').length I get 1 not 4. Am I doing something wrong? Thanks.
[jQuery] Re: Disable input button, using wrong HTML code?
stephen wrote: I created a test page here: http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this? $(#button).attr(disabled,disabled); -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: is next() recursive?
On Wed, May 6, 2009 at 6:36 AM, Paul Mills paul.f.mi...@gmail.com wrote: Hi, Your code is missing th /ul for ul id=second When I add this in everything toggles as expected -- http://jsbin.com/esaso/edit I was just going to reply to my own post. Everything's good, the problem was not with next() and everything works as it should. The missing /ul was in the example only.
[jQuery] Re: Disable input button, using wrong HTML code?
I tried that too, has same results... On May 6, 9:35 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: stephen wrote: I created a test page here:http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this? $(#button).attr(disabled,disabled); -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: Disable input button, using wrong HTML code?
Right. The disabled attribute takes an actual string, not a boolean. You can set even set it to true if you prefer: $(#button).attr(disabled,true); -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jonathan Vanherpe (T T NV) Sent: Wednesday, May 06, 2009 9:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Disable input button, using wrong HTML code? stephen wrote: I created a test page here: http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this? $(#button).attr(disabled,disabled); -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: Disable input button, using wrong HTML code?
Stephen Korecky wrote: I tried that too, has same results... On May 6, 9:35 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: stephen wrote: I created a test page here:http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this? $(#button).attr(disabled,disabled); -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be If you're talking about what you see in Firebug: this just shows Gecko's internal DOM tree, which isn't necessarily the same as how the w3c would like it to be. If you change your html to be input disabled=disabled /, you'll see that firebug will drop the value too. Most browsers just ignore the value of disabled and just look at the existence of the attribute (which you'll have to keep in mind when you use jquery to reenable the button, you'll need to remove the attribute, not just set it to false). the 'correct' way is disabled=disabled, though. Jonathan -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] How can I refresh jQuery object's DOM (after having AJAXed dynamic content)?
Hello list, Is there a way I can refresh the jQuery object's DOM on command so that it can acknowledge content that's been brought in after the initial DOM ready event? Ideally, I'd find something that looked a bit like this: $.get('wad_of_unknown_content.php', someVariableParameters, $.reloadPageDOM()) I've run into the situation where a load of AJAXed content is essentially dead to my jQuery object. I'm surprised at the variety of ways people have dealt with highly specific symptoms of the problem: there are plugins like livequery, which looks to me like an overhead- intensive method for modifying event bindings; then there are a variety of ways of writing functions your dynamic content may be sensitive to into large superfunctions which get called back whenever said dynamic content is loaded. In particular, everything out there seems to be concerned exclusively with event binding on objects within the dynamic content, and the solutions all seem to involve re-writing specific bindings or the functions calling the dynamic content themselves. Why not just get jQuery to read over the existing document as it stands and assimilate that into the jQuery worldview whenever a batch of new content is introduced? Or have insertion methods that edit the document in question and the jQuery DOM object at the same time? Would be very interested to hear alternatives as to how to deal with this.
[jQuery] Re: Disable input button, using wrong HTML code?
Even that still returns disabled= On May 6, 9:41 am, Andy Matthews li...@commadelimited.com wrote: Right. The disabled attribute takes an actual string, not a boolean. You can set even set it to true if you prefer: $(#button).attr(disabled,true); -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Jonathan Vanherpe (T T NV) Sent: Wednesday, May 06, 2009 9:35 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Disable input button, using wrong HTML code? stephen wrote: I created a test page here: http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this? $(#button).attr(disabled,disabled); -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be
[jQuery] Re: Disable input button, using wrong HTML code?
On May 6, 9:46 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: Stephen Korecky wrote: I tried that too, has same results... On May 6, 9:35 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: stephen wrote: I created a test page here:http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this? $(#button).attr(disabled,disabled); -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be If you're talking about what you see in Firebug: this just shows Gecko's internal DOM tree, which isn't necessarily the same as how the w3c would like it to be. If you change your html to be input disabled=disabled /, you'll see that firebug will drop the value too. Most browsers just ignore the value of disabled and just look at the existence of the attribute (which you'll have to keep in mind when you use jquery to reenable the button, you'll need to remove the attribute, not just set it to false). the 'correct' way is disabled=disabled, though. Jonathan -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be Ah, that makes more sense then, I know the 'correct' way is disabled=disabled which is why I was confused as to why this was even working... Since I was also trying to use CSS to select disabled elements input=[disabled=disabled]{background:#EEE;} then I looked at the source with FireBug and Safari's Developers Toolkit with same results. But thanks for your help!
[jQuery] Re: [cycle] transparent pngs on background in IE
I've not managed to solve this but have found this which explains things a little: http://blog.pengoworks.com/index.cfm/2009/2/17/Fading-a-24bit-transparent-PNG-in-IE7 In my case, these didn't work so I'm moving over to gifs - sadly the images don't look anywhere near as nice but there doesn't seem to be much of an alternative. On Tue, May 5, 2009 at 1:01 PM, Michael Smith smi...@gmail.com wrote: Hi there, I'm having trouble getting jquery cycle to work when I have a background image and a transparent png: http://dev2.dianomioffers.co.uk/smartads.epl?id=264subtype=Cdebug=1 It's fine in Firefox but in IE (version 7) I get a black colour where the png transparency is during the fade. I'm using cleartype:true and cleartypeNoBg:true Can this be made to work right? Thanks Michael
[jQuery] Re: efficient way to find a parent
.parent() gets you the immediate parent of the element, .parents() traverses up through all ancestors, so you could use .parents('.user') and it wouldn't matter how deep you nest the link. You can also use .closest(), which finds the closest parent that matches the specified selector: $(this).closest('.user').attr('id') Check out the docs for traversing http://docs.jquery.com/Traversing On May 5, 7:49 pm, jquerysk sh.koiz...@gmail.com wrote: I want to find a parent for a button. I have set up the html like the following. div id='user_123' class='user' h1My name goes here/h1 psome description/p a href='Javascript:{}' class='select' /div The thing is that I need to specify how many steps I have to go up to get the parent id( see the bottom ) and if I add another tag I migh have to change this source. Is there any way to specify using class ( maybe $(this).parent(.user).attr(id) ?) so that I don't need to specify how many level I have to go up in order to get that id? $().ready(function(){ $(.select).click(function(){ alert($(this).parent().attr(id)); }); }); Thanks in advance.
[jQuery] Re: [autocomplete] Bug in click function
On 5/5/09 1:59 PM, tudela rafael.tud...@gmail.com wrote: Hi, I was using the autocomplete and found a bug in the click function, follow the code: Actual code: // In this code you need to click twice in the input element to show the results. .click(function() { // show select when clicking in a focused field if ( hasFocus++ 1 !select.visible() ) { onChange(0, true); } Fixed code: // I just added = instead of , so you only need one click to show the results .click(function() { // show select when clicking in a focused field if ( hasFocus++ = 1 !select.visible() ) { onChange(0, true); } That's it... there's an email thread in the archives of this list that shows that the two-clicks to show is intentional design. i have to admit i don't understand why it was designed this way. but when i made the same change that you explain above, it caused other UI problems with my app (sorry, i can't remember what) so i changed it back.
[jQuery] Re: Resetting the reset button
Rob, Thanks a ton. I was able to code up what I needed with your advice. Here's what I did, in case someone else out there needs to do something like this in the future. Russ /** * Set all the default values of a form to whatever is there now, effectively updating the reset * button to restore the form to the current state (which might be different than the state the * form was in when the page was loaded). * * @param formID Form id (starting with #) to update the default values of */ function resetFormToNewValues(formID) { $(formID).find(':input').each(function () { if ($(this).is(':text')) { // TODO - Not tested for textareas $(this).attr(defaultValue, $(this).attr(value)); } else if ($(this).is(':checkbox, :radio')) { $(this).attr(defaultChecked, $(this).attr(checked)); } else if ($(this).is('select')) { $(this).find(option:selected ).attr (defaultSelected, true); $(this).find(option:not(:selected)).attr (defaultSelected, false); } else if ($(this).is(':password, :file')) { // TODO - This is untested $(this).attr(defaultValue, ); } }); }
[jQuery] Re: barackslideshow effect in jquery.
maybe this: http://devthought.com/blog/projects-news/2008/06/barackslideshow-an-elegant-lightweight-slideshow-script/ - Jack idrish laxmidhar wrote: hi all..i am looking for a similar effect like the barackslideshow effect. can anyone suggest such a plugin in jquery. thanks a lot
[jQuery] FRAMES
hi, I need to refer to a frame, in plain JavaScript it is: parent.frames.main.emplmain.document.getElementById ('mail').style.display='block'; how would I do this in jQuery (so I can do neat things like fadeIn(), etc...;) thank you..
[jQuery] jquery-roundcorners-canvas - not working on table border
I'm trying to use the plugin jquery-roundcorners-canvas.js on a table but the border is not rounded like the background. Has anyone else found this to be a problem? Any solutions? TIA
[jQuery] [jQuery AJAX]
I am using the jquery.form.js addon, and I was wondering if there was a way that I could add something to check for a certain string in resulting response? I am having a form sending an AJAX request to the server which then places the result into the div that is used for responses but I am unsure how to initialize a check when the div updates that word is used in the div for example experience... when that comes up I would like to disable a feature to keep the form from submitting again... Any ideas how I would check the string? Maybe when I submit probably? Thanks for your help ahead of time...
[jQuery] Re: The jQuery Object, Namespaces, and Program Modules -- Connecting the Dots Between jQuery and Javascript
On May 5, 1:53 pm, Matt Kruse m...@thekrusefamily.com wrote: On May 5, 3:38 pm, kiusau kiu...@mac.com wrote: QUESTION: If a lone pair of parentheses can be used to automatically call a function, then what does it mean when two pairs are juxtaposed in the same statement as follows: ()(jQuery);? See, this is purely a javascript language question, unrelated to jQuery specifically. In js, () around something simply returns what is inside of it. So, (x) ===x. That is not entirely true, as the statement:- x(true); should be a interpreted as call operation, the stuff inside of the parens is an ArgumentList in that case. () - can be: * a grouping operator * an Arguments expression (for use with a [[call]] or [[construct]] operation). * part of the production for a function definition, as function(){} (and also a JS 1.8 expression closure[1], a non-standard language extension). Then, (function() { }) Grouping Operator. simply returns the anonymous function object. And how do you call a function? You put () after it. (function() { })(); Calling a function. The Arguments can also be used for construct, or new:- var time = new (function(x){ this.timeStamp = +new Date; this.end = new Date(x); // Invalid Date. })(Infinity); [...] Garrett
[jQuery] Re: The jQuery Object, Namespaces, and Program Modules -- Connecting the Dots Between jQuery and Javascript
I'll back up even more, to a very-high level, because these concepts weren't instantly evident to me; once I realized them it helped me to better conceptualize how and why jQuery works as it does. $() aka jQuery(), is basically an implementation of the Factory Pattern, in which one object is responsible for the creation of other objects. Of course, it also follows the Prototype pattern; given that JS is a prototypal language and that the $()/jQuery() function extends itself into the new object that is created. Another pattern to be found is the Fluent Interface pattern; this is what gives jQuery its expressive power by way of chaining. This pattern is very simple, and yet also very powerful; imagine jQuery without chaining! Anyone notice any other design patterns within jQuery? On May 5, 9:13 am, kiusau kiu...@mac.com wrote: QUESTION: I am looking for an article that explains the conceptual relationship between jQuery and Javascript. Can anyone point me in the proper direction? BACKGROUND: In my quest to understand why some things in my webpage work while others do not I found the following, very useful article about the YAHOO object, the creation of namespaces, and how to control the number of global variables -- namely, through the creation of modules that are based on a single object. jQuery appears to be just such an object, on the one hand, but something entirely different on the other. Many days ago when I first started using jQuery someone provided me with a formula for creating jQuery methods. A formula that I have dutifully applied over and over again, but I now believe to excess. The formula was the following: (function($) {$.fn.METHOD_NAME = function() {FUNCTION_CODE}})(jQuery); In my young mind there are important similarities between this expression and that outlined in the very useful article written by Eric Miraglia (see below) for the creation of a YAHOO namespace and a program module. I would now like to make the connection, if there is one, and am asking where is the best place to find out. Surely this connection would help me understand the relationship between jQuery and Javascript. I remember someone in this forum also having said jQuery IS Javascript. I believe them, but am obviously having difficulty understanding in what way. USEFUL ARTICLE: http://yuiblog.com/blog/2007/06/12/module-pattern/ Roddy
[jQuery] jCarousel - set start variable based on class w/Dynamic data
I have a dynamic jCarousel which pulls in JSON data from php, and prints out the list html. What I'm trying to do is set the carousel start item as a variable, which would find the item with the class .active, and start with that item. The problem is that since the data is dynamic when it looks for the start item, the list hasn't yet been rendered, therefore doesn't find any class or list data. The code below works with a static list, but not dynamic. I think my options are (a) wait for carousel to load, then somehow set the start item after, or (b) after list loads auto-scroll to the item with class .active. Neither of which I know how to do. Or maybe you have a better idea that i've missed? Help please, I've exhausted all my ideas at this point, need some help. Here's the code i'm working with for the dyamic list: -- script language=javascript $(document).ready(function() { /* create an image slideshow from a JSON array using jcarousel */ var itemLoadCallback = function(carousel, state) { if (state != 'init') { return; } jQuery.getJSON(json_output.js, function(data){ itemAddCallback(carousel, carousel.first, carousel.last, data.items); }); }; var itemAddCallback = function(carousel, first, last, data) { for (i = 0, j = data.length; i j; i++) { carousel.add(i, getItemHTML(data[i])); } carousel.size(data.length); }; /* format the data in each li */ var getItemHTML = function(d) { return 'div class=' + d.active + 'div class=lb-rank' + d.rank + '/divdiv class=lb-photoa class=' + d.active + ' target=_blank href=' + d.profile_url + 'img class=product alt=product photo src=' + d.pic + ' border=0 //a/divdiv class=lb-namediv class=lb-name-truncatea target=_blank href=' + d.profile_url + '' + d.name + '/a/divh1' + d.score + '/h1/divdiv class=lb-iconsa class=smack- button href=' + d.smack_url + 'img src=../images/spacer.gif width=50 height=45 border=0 alt=... title=Send Smack Talk to this friend //a/div/div'; }; /* print out the carousel custom config */ var container = $('#mycarousel'); //better call the whole thing from inside document.ready var startPlace = $('a',container).index($('.active',container)); jQuery('#mycarousel').jcarousel({ itemLoadCallback: itemLoadCallback, start: startPlace, scroll: 3 }); }); /script /head body ul id=mycarousel class=jcarousel jcarousel-skin-tango /ul /body
[jQuery] Set text property of server control
Hi, I am creating a dialog that has three asp.net buttons inside it. I want to change the text property of the buttons from jquery. I have tried the following code but it does not work. The text is not changed. //server control id=b1 var b1 = $(#%=b1.ClientID %); b1.text(yes); I have also tried b1 = $([id$=b1]); b1.attr(Text, yes); Can someone please tell me what I am doing wrong? King Regards Cecilia -- View this message in context: http://www.nabble.com/Set-text-property-of-server-control-tp23386712s27240p23386712.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] SimpleModal issues... too many scripts?
Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance!
[jQuery] Preloading files
Hi there! First of all I want to thank author for this great plugin! Here is my situation: I am trying to implement this plugin to some content's edit page (written in php), that means that content may already have uploaded files with it so I need somehow to Preload this files (or just filenames) into MultiUpload input.. I am not so strong in jquery (in level of creating/editing plugins at least), so I faced difficulty by trying to do that. Could you please help me. What I think I should do first is after document is loaded run addToList() function with name of (for example) image that was uploaded with adding form before. Question is how to do that (if this is correct way) as I didn't even succeed to run it and what else should be done. Thanks in advance, Sergio
[jQuery] Need Help to Apply effect to newly created element
Hi, I am using jQuery for multiple file upload. Now my requirement is as follows: 1) I can create file element dynamically through javascript. 2) I need to apply the jQuery ability to add multiple file in newly created element. Below are my js files script src=js/jquery.js type=text/javascript/script script src=js/documentation.js type=text/javascript/script link href=css/documentation.css type=text/css rel=stylesheet/ !--// plugin-specific resources //-- script src=js/jquery.form.js type=text/javascript language=javascript/script script src=js/jquery.MetaData.js type=text/javascript language=javascript/script script src=js/jquery.MultiFile.js type=text/javascript language=javascript/script script src=js/jquery.blockUI.js type=text/javascript language=javascript/script Code to add input file dynamically var td7 = document.createElement(TD) var newInputElem = document.createElement(INPUT); newInputElem.type = 'file'; newInputElem.name = 'images[]'; newInputElem.className = 'multi accept-jpg|gif'; newInputElem.size = 5; td7.appendChild(newInputElem); Code for simple input file input name=images[] type=file class=multi accept=gif|jpg size=5 / The code works for simple input file, but when i create a dynamic input file I am not able to upload multiple file for that. Can you suggest me the way to find out the solution. Thanks, Jigar Mistry
[jQuery] How to get an array of values?
Let's say I want an array of all the values for checked checkboxes on my page. How do I do this? This: $('input:checkbox:checked').val() ..only returns the first value. Is there a function that will return a javascript array of values? Thanks.
[jQuery] SimpleModal issues... too many scripts?
Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups jQuery (English) group. To post to this group, send email to jquery-en@googlegroups.com To unsubscribe from this group, send email to jquery-en+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jquery-en?hl=en -~--~~~~--~~--~--~---
[jQuery] Performance of parent child selector vs .children() method
Essentially, I'd like to know if there is any difference between $(div.grandparent div.parent div.child) and $(div.grandparent).children(div.parent).children(div.child) Does anyone know which of these is more performant or preferred when selecting child nodes? Thanks.
[jQuery] Re: How to get an array of values?
On Wed, May 6, 2009 at 10:20 AM, hellolindsay hellolind...@gmail.com wrote: Let's say I want an array of all the values for checked checkboxes on my page. How do I do this? This: $('input:checkbox:checked').val() ..only returns the first value. Is there a function that will return a javascript array of values? $('input:checkbox').serializeArray(); (taken from http://groups.google.com/group/jquery-en/browse_thread/thread/2a24fbda70c64670) -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: refresh image?
On May 6, 6:46 am, heohni heidi.anselstet...@consultingteam.de wrote: Hi, after sending a form, I would like to reload the form in order to send a new message. Therefore I was resetting the old form, but I need to call a new captch image. It's currently like this: img src=inc/captcha/captcha.php id=captcha alt= border=0 style=float:left; / I thought I coud re-load it with: $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php); But this way I don't get a new call... to generate a new image and with it connected a new session entry for the captcha code. What can I do to create a real call to the file? Any ideas? .replaceWith() replaces one element with another. Use this: $(#captcha).attr(src, inc/captcha/captcha.php); This will reload the image assuming captcha.php is correctly sending a no-cache header.
[jQuery] Re: JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
Jon - Good catch - however that was just a cut/paste problem - below is a new example that does not work as expected - for some reason the validation errors are ignored and the form is posted - not what I was expecting. Is there something else I need to do to prevent form from posting on errors? Why would the validation errors get ignored? Any ideas? TIA !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/ js/jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/ js/jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { subject: required, email:{ required: true, email: true } }, messages: { subject: Enter subject info, email: Enter email info, } }); }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/ thtdinput id=id_subject type=text name=subject maxlength=100 //td/tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel for=id_msgtextText:/label/thtdtextarea id=id_msgtext rows=10 cols=40 name=msgtext/textarea/td/ tr tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table /form /div /body /html On May 5, 10:35 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You define rules for a field sender, but there is no input with name=sender. Jörn On Tue, May 5, 2009 at 7:28 PM, BrendanC bren...@gmail.com wrote: JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: { sender: Enter sender's name, } }); return false; }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img
[jQuery] Re: refresh image?
For reference, this php should properly force no-cache: Just be sure to replace $mime with the correct type for the image (jpg, gif, whatever you're sending) header('Content-Type: ' . $mime); header('Cache-Control: no-cache'); header('Pragma: no-cache'); On May 6, 2:30 pm, Ricardo ricardob...@gmail.com wrote: On May 6, 6:46 am, heohni heidi.anselstet...@consultingteam.de wrote: Hi, after sending a form, I would like to reload the form in order to send a new message. Therefore I was resetting the old form, but I need to call a new captch image. It's currently like this: img src=inc/captcha/captcha.php id=captcha alt= border=0 style=float:left; / I thought I coud re-load it with: $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php); But this way I don't get a new call... to generate a new image and with it connected a new session entry for the captcha code. What can I do to create a real call to the file? Any ideas? .replaceWith() replaces one element with another. Use this: $(#captcha).attr(src, inc/captcha/captcha.php); This will reload the image assuming captcha.php is correctly sending a no-cache header.
[jQuery] jqModal inserting links with live clicks doesn't work
I read a bit on the new jqModal version that has live events on the a.jqModal (Actually reading this didn't tell me whether live events were enabled on .jqModal by default, or if you had to make the call shown in the code, but that's neither here nor there) So, I have a control panel list users of a system. The user name is an a.jqModal link to their href /users/xx/edit which is loaded through an ajax call using this code: $(function(){ $(#modal).jqm({ajax:'@href'}) }) and a class=jqModal href=/admin/users/35/editAdmin User/a Adding a user is done through a modal window. It submits through an ajax call, retrieves the user partial (rails) back from the db, and appends it to the list of users. The only problem is, the link now redirects to the href rather than loading it through ajax for that newly appended user. I tried adding this: $(a.jqModal).click(function(){ $(#modal).jqmShow(); }) After my append of the new row. This sort of works, in that when you click that new user, the overlay pops up and would most likely load the content, but it still redirects. It's like it's missing a return false; somewhere in there. Anyone else have this problem with appending new data through jscript that uses jqModal?
[jQuery] Re: Preloading files
Sorry, I thought I am writing in group of MultiFile Plugin (http:// www.fyneworks.com/jquery/multiple-file-upload/) Would appreciate if anyone could help.
[jQuery] Re: SimpleModal issues... too many scripts?
I just took a look and it looks like the main issue is that you are not binding the link correctly. You need to modify the selector in confirm.js from: $('#confirmDialog input.confirm, #confirmDialog a.confirm').click (function (e) { ... }); to: $('#navPhysicians a.confirm').click(function (e) { ... }); HTH On May 6, 10:53 am, Steeleclipse steelecli...@gmail.com wrote: Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance!
[jQuery] Re: Is it possiblwe to use this in slection
Thanks a lot Eric, It worked fine.
[jQuery] Re: SimpleModal issues... too many scripts?
Thanks for your reply. I will try that tonight and post how it goes! On May 6, 3:37 pm, Eric Martin emarti...@gmail.com wrote: I just took a look and it looks like the main issue is that you are not binding the link correctly. You need to modify the selector in confirm.js from: $('#confirmDialog input.confirm, #confirmDialog a.confirm').click (function (e) { ... }); to: $('#navPhysicians a.confirm').click(function (e) { ... }); HTH On May 6, 10:53 am, Steeleclipse steelecli...@gmail.com wrote: Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance!
[jQuery] Re: recursive dom walker
Thanks Eric So is the only way to chain from an extended function in jQuery is to use $.fn.recurse= function(){} I cannot uses $.recurse = function() { } and return the jQuery object from within this function? Thanks andy On May 6, 3:13 pm, Eric Garside gars...@gmail.com wrote: Your recurse function is not a method of the jQuery.fn object, so it can't work on elements. The line: $.recurse = function(options) { should be $.fn.recurse = function(options) { On May 6, 9:00 am, AndyCramb andycr...@googlemail.com wrote: I am trying to write a plugin that will eventually match a specific string pattern on the id attribute of all form element(s) I aim to get a collection of all elements that I want to return for chaining I generate a regular expression on the fly based on the arguments passed in and use this to find an initial set of elements I have this returning jquery objects using this $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) this also works $(:input).filter(function() { return $(this).attr(id).match(regEx); }).setDisabled(true); But when I use this $(#a_1).recurse({source:a_1}).setDisabled (true); ,my plugin function I get this TypeError: $(#a_1).recurse is not a function Its my first attempt at a plugin and I guess I am not returning the jquery object and I am not sure if this is the correct approach Anyway any advice would be much appreciated Full code below (function($) { $.recurse = function(options) { var defaults = { delimeter: _ , level: 1 , dir: down , source: body } var settings = $.extend({}, defaults, options); // funtion to find regEx function generateRegEx(delimeter, src, direction) { console.log(src.split(delimeter)); console.log(src.length); // need to have the concept of next and prev // so for prev or back take away a wholePattern match // and fro next or forward add a pattern match // so based on src and the up or down param var dir = direction arr = src.split(delimeter); var arrLength = arr.length; console.log(arrLength); if (arrLength = 1 direction == up) { //alert(the only way is forward); throw Error(you can only go up from here); direction = up; } arrLength = (direction == up) ? arrLength - 2 : arrLength; //^([0-9a-zA-Z-]+\_){3}$ - this gets all the pattern does ntot take account of src // supercedes the one above ^a_1(\_[0-9a-zA-Z-]+){2}$ var delPattern = src + (\\ + delimeter + [0-9a-zA-Z-] +); //this will match the character that separates the levels var numerOfPattern = { + arrLength + }; //this matches all alpha-numeric characters in between the delimeters var wholePattern = delPattern + numerOfPattern; // this combines them both console.log(wholePattern); var pattern = ^ pattern += wholePattern; pattern += $; console.log(pattern); return new RegExp(pattern); }; var regEx = generateRegEx(settings.delimeter, settings.source, settings.dir); $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) }; })(jQuery);
[jQuery] Re: recursive dom walker
You can return the jQuery object, but jQuery will throw undefined if you attempt to call $('.selector').recurse You'd have to call $.recurse You can implement a pretty quick fix, if you don't plan on doing much else with the function. Try: $.recurse = $.fn.recurse = function(options){ ... } On May 6, 3:51 pm, AndyCramb andycr...@googlemail.com wrote: Thanks Eric So is the only way to chain from an extended function in jQuery is to use $.fn.recurse= function(){} I cannot uses $.recurse = function() { } and return the jQuery object from within this function? Thanks andy On May 6, 3:13 pm, Eric Garside gars...@gmail.com wrote: Your recurse function is not a method of the jQuery.fn object, so it can't work on elements. The line: $.recurse = function(options) { should be $.fn.recurse = function(options) { On May 6, 9:00 am, AndyCramb andycr...@googlemail.com wrote: I am trying to write a plugin that will eventually match a specific string pattern on the id attribute of all form element(s) I aim to get a collection of all elements that I want to return for chaining I generate a regular expression on the fly based on the arguments passed in and use this to find an initial set of elements I have this returning jquery objects using this $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) this also works $(:input).filter(function() { return $(this).attr(id).match(regEx); }).setDisabled(true); But when I use this $(#a_1).recurse({source:a_1}).setDisabled (true); ,my plugin function I get this TypeError: $(#a_1).recurse is not a function Its my first attempt at a plugin and I guess I am not returning the jquery object and I am not sure if this is the correct approach Anyway any advice would be much appreciated Full code below (function($) { $.recurse = function(options) { var defaults = { delimeter: _ , level: 1 , dir: down , source: body } var settings = $.extend({}, defaults, options); // funtion to find regEx function generateRegEx(delimeter, src, direction) { console.log(src.split(delimeter)); console.log(src.length); // need to have the concept of next and prev // so for prev or back take away a wholePattern match // and fro next or forward add a pattern match // so based on src and the up or down param var dir = direction arr = src.split(delimeter); var arrLength = arr.length; console.log(arrLength); if (arrLength = 1 direction == up) { //alert(the only way is forward); throw Error(you can only go up from here); direction = up; } arrLength = (direction == up) ? arrLength - 2 : arrLength; //^([0-9a-zA-Z-]+\_){3}$ - this gets all the pattern does ntot take account of src // supercedes the one above ^a_1(\_[0-9a-zA-Z-]+){2}$ var delPattern = src + (\\ + delimeter + [0-9a-zA-Z-] +); //this will match the character that separates the levels var numerOfPattern = { + arrLength + }; //this matches all alpha-numeric characters in between the delimeters var wholePattern = delPattern + numerOfPattern; // this combines them both console.log(wholePattern); var pattern = ^ pattern += wholePattern; pattern += $; console.log(pattern); return new RegExp(pattern); }; var regEx = generateRegEx(settings.delimeter, settings.source, settings.dir); $(:input).filter(function() { //return this.id.match(regEx); return $(this).attr(id).match(regEx); }) }; })(jQuery);
[jQuery] [autocomplete] remove dynamically
Hi, How do I remove autocomplete from the text box dynamically. I have a text box that will perform two kinds of searches depending on the context (don't ask me why, beyond my control). I need to remove previous autocomplete and attach new one. Difference is in the url that it goes against. Or maybe there is a way to change Url and some options dynamically? I've been trying this with no luck. It just keeps adding new autocompletes. This is markup after binding in aspx page. $(#rbClientName).click( function() { debugger; $(#ctl00_mainBody_txtClientNumber).unbind (autocomplete); //clear text and focus $(#ctl00_mainBody_txtClientNumber).val().focus (); //attach autocomplete to txtClientNumber text box $(#ctl00_mainBody_txtClientNumber).autocomplete ('ws://../WebServices/ClientSearch.asmx/GetClientNameSearchResults', { multiple: false, minChars: 3, max: 100, mustmatch: true, scroll: false, highlight: function(value, term) { return value; }, formatItem: function(item) { return format(item); } })
[jQuery] Re: How to get an array of values?
You can also do this: $(':checkbox').map(function() { return this.value; }); or, if you just want an array of checked checkbox values, do this: $(':checkbox:checked').map(function() { return this.value; }); --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On May 6, 2009, at 2:26 PM, Charlie Griefer wrote: On Wed, May 6, 2009 at 10:20 AM, hellolindsay hellolind...@gmail.com wrote: Let's say I want an array of all the values for checked checkboxes on my page. How do I do this? This: $('input:checkbox:checked').val() ..only returns the first value. Is there a function that will return a javascript array of values? $('input:checkbox').serializeArray(); (taken from http://groups.google.com/group/jquery-en/browse_thread/thread/2a24fbda70c64670) -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.
[jQuery] Re: JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
You can set debug:true for debugging. It will always prevent the form submit, which is useful to look at errors that are thrown during validation. Jörn On Wed, May 6, 2009 at 8:37 PM, BrendanC bren...@gmail.com wrote: Jon - Good catch - however that was just a cut/paste problem - below is a new example that does not work as expected - for some reason the validation errors are ignored and the form is posted - not what I was expecting. Is there something else I need to do to prevent form from posting on errors? Why would the validation errors get ignored? Any ideas? TIA !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/ js/jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/ js/jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { subject: required, email:{ required: true, email: true } }, messages: { subject: Enter subject info, email: Enter email info, } }); }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/ thtdinput id=id_subject type=text name=subject maxlength=100 //td/tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel for=id_msgtextText:/label/thtdtextarea id=id_msgtext rows=10 cols=40 name=msgtext/textarea/td/ tr tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table /form /div /body /html On May 5, 10:35 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You define rules for a field sender, but there is no input with name=sender. Jörn On Tue, May 5, 2009 at 7:28 PM, BrendanC bren...@gmail.com wrote: JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title link href=/media/css/default.css media=screen type=text/css rel=stylesheet style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { sender: required, minlength:4 }, messages: {
[jQuery] Re: Superfish : close on click outside the menus
Well... I answer myself: $(document).click(function() { $('ul.sf-menu').hideSuperfishUl(); }); On May 5, 11:41 am, Paulo JF Silva alfa...@gmail.com wrote: Hi, I want to use theSuperfishmenu plugin but with 1 more behaviour: when the user clicks outside the menu, the menu closes. (or clicks anywhere, doesn't matter). This way I can have a large delay and just tell people to close the menu by clicking outside the menu, which will improve greatly the usability of the menu. Anybody already did this or know how to?
[jQuery] Re: The jQuery Object, Namespaces, and Program Modules -- Connecting the Dots Between jQuery and Javascript
On May 6, 10:34 am, dhtml dhtmlkitc...@gmail.com wrote: var time = new (function(x){ this.timeStamp = +new Date; this.end = new Date(x); // Invalid Date. })(Infinity); How do you explain that both time.timeStamp and time.end are returned without error in the following: var time = new (function(x){ this.timeStamp = + new Date; this.end = new Date(x); // Invalid Date. })(1241646503107); alert(time.timeStamp); alert(time.end); but the following results when no integer is entered: 1) (time) // invalid date, with no error 2) () // invalid date with no error 3) (time.timeStamp) // error 4) (time()) // error REFERENCE: http://homepage.mac.com/moogoonghwa/practice/JavaScript/js_parentheticalOperator.html
[jQuery] Re: refresh image?
you can, replace your querystring... $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php?test=123); in the next reload $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php?test=231); it isn't the best practice... 2009/5/6 Eric Garside gars...@gmail.com For reference, this php should properly force no-cache: Just be sure to replace $mime with the correct type for the image (jpg, gif, whatever you're sending) header('Content-Type: ' . $mime); header('Cache-Control: no-cache'); header('Pragma: no-cache'); On May 6, 2:30 pm, Ricardo ricardob...@gmail.com wrote: On May 6, 6:46 am, heohni heidi.anselstet...@consultingteam.de wrote: Hi, after sending a form, I would like to reload the form in order to send a new message. Therefore I was resetting the old form, but I need to call a new captch image. It's currently like this: img src=inc/captcha/captcha.php id=captcha alt= border=0 style=float:left; / I thought I coud re-load it with: $(#captcha).attr(src).replaceWith(inc/captcha/captcha.php); But this way I don't get a new call... to generate a new image and with it connected a new session entry for the captcha code. What can I do to create a real call to the file? Any ideas? .replaceWith() replaces one element with another. Use this: $(#captcha).attr(src, inc/captcha/captcha.php); This will reload the image assuming captcha.php is correctly sending a no-cache header.
[jQuery] Multiple selectors failing in Safari
Hello, I have an input box searching a XML file for a string. Anything the user types in, the script searches through the XML file in the name and conference tags for results. This works just fine in Firefox. However, in Safari, it only returns a result when a single search result is found. I've narrowed it down to this line, and I have no idea what is wrong with it. Am I wrong in my use of selectors in this way? Or is it a Webkit bug? $(xml).find('name:contains(' +searchString+ '),conference:contains (' +searchString+ ')').each(function() { print results });
[jQuery] webkit-specific problem with jcarousel
Hi! I am using the jcarousel plugin for a gallery site I am working on. I use the carousel to scroll the thumbnails. When I test my code in firefox everything works fine but I run into problems with webkit- based browsers, like safari or chrome. When I scroll the carousel a new li-element is prepended in the list. The element has classes ending with NaN instead of a number. I have been trying to debug this problem for some hours now but as I am not so versed with javascript I suspect that I am missing something. The site is available at home.nibbo.se Any ideas are appreciated. Thanks Felix
[jQuery] Scoping issue with load and call back function.
I am a relative newbie to Jquery and I am getting some scoping issues I can't figure out. I was hoping for some advice. Basically I am trying to load multiple documents that have HTML tables and then parse the tables and redisplay in a new format. Merging elements from the different documents. So basically I build the url path for a set of devices and load them. I thought in the load function I could collect elements into global variables and manipulate in the final document. But is not working. The variables TableCells, TableRowName and TableColName are what I have issues with. $(document).ready(function(){ $.ajaxSetup({cache: false}) ; var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; for( var i =0; i devList.length; i++) { // set the path var path = prefix + yield_dir + devList[i] +'/' + smslot_yield; //clear the display area $('#display').html(); var colName =[]; var rowName =[]; var cellValue = []; //load the page but collect the table info if (firstLoad == 1) { $('#display').load(path, function(){ manipulate tables and put data in Global Array TableCells[i] = cellValue; TableRowName[i] = rowName; TableColName[i] = colName; }); } } }); So the variables are defined in the document ready scope. (I even tried outside that as well) var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; I set these variables in the load function scope and they are accessible there and work fine. However when I try to access outside the load function the variables are undefined. Can you tell what I am missing? Thanks, Steve
[jQuery] Re: Scoping issue with load and call back function.
When you say you get undefined outside the load function, do you mean outside $(document).ready, or inside $(document).ready? They should not be accessible outside document.ready, because of the closure caused by passing the anonymous function to document.ready, and because you use var to declare them inside that function. If you want them to be accessible globally, you'll have to declare them outside document.ready. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Stever Sent: Wednesday, May 06, 2009 3:54 PM To: jQuery (English) Subject: [jQuery] Scoping issue with load and call back function. I am a relative newbie to Jquery and I am getting some scoping issues I can't figure out. I was hoping for some advice. Basically I am trying to load multiple documents that have HTML tables and then parse the tables and redisplay in a new format. Merging elements from the different documents. So basically I build the url path for a set of devices and load them. I thought in the load function I could collect elements into global variables and manipulate in the final document. But is not working. The variables TableCells, TableRowName and TableColName are what I have issues with. $(document).ready(function(){ $.ajaxSetup({cache: false}) ; var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; for( var i =0; i devList.length; i++) { // set the path var path = prefix + yield_dir + devList[i] +'/' + smslot_yield; //clear the display area $('#display').html(); var colName =[]; var rowName =[]; var cellValue = []; //load the page but collect the table info if (firstLoad == 1) { $('#display').load(path, function(){ manipulate tables and put data in Global Array TableCells[i] = cellValue; TableRowName[i] = rowName; TableColName[i] = colName; }); } } }); So the variables are defined in the document ready scope. (I even tried outside that as well) var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; I set these variables in the load function scope and they are accessible there and work fine. However when I try to access outside the load function the variables are undefined. Can you tell what I am missing? Thanks, Steve
[jQuery] Re: Scoping issue with load and call back function.
Josh thanks for the quick response. I tried putting the variables var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; outside the document ready function. Originally. (not redefined with var inside document ready shown here). script type=text/javascript src=http://www.hou.asp.ti.com/ sparcit_data_reports//js/jquery.js/script script type=text/javascript var devList = [ PART_1 ]; var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; $(document).ready(function(){ $.ajaxSetup({cache: false}) ; var firstLoad = 1; for( var i =0; i devList.length; i++) { // set the path var path = url + devList[i] ; var colName =[]; var rowName =[]; var cellValue = []; //load the page but collect the table info if (firstLoad == 1) { $('#display').load(path, function(){ manipulate tables and put data in Global Array TableCells[i] = cellValue; TableRowName[i] = rowName; TableColName[i] = colName; }); var lenTable2 = TableColName[i].length; } } }); So where I try to access the new length of TableColName[i] I get that this variable is undefined. Actually while debugging, I find that variable i defined in the loop outside the load, is NOT available inside the load function. It is all very confusing. :-( On May 6, 6:10 pm, Josh Nathanson joshnathan...@gmail.com wrote: When you say you get undefined outside the load function, do you mean outside $(document).ready, or inside $(document).ready? They should not be accessible outside document.ready, because of the closure caused by passing the anonymous function to document.ready, and because you use var to declare them inside that function. If you want them to be accessible globally, you'll have to declare them outside document.ready. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Stever Sent: Wednesday, May 06, 2009 3:54 PM To: jQuery (English) Subject: [jQuery]Scopingissuewith load and call back function. I am a relative newbie to Jquery and I am getting somescopingissues I can't figure out. I was hoping for some advice. Basically I am trying to load multiple documents that have HTML tables and then parse the tables and redisplay in a new format. Merging elements from the different documents. So basically I build the url path for a set of devices and load them. I thought in the load function I could collect elements into global variables and manipulate in the final document. But is not working. The variables TableCells, TableRowName and TableColName are what I have issues with. $(document).ready(function(){ $.ajaxSetup({cache: false}) ; var TableCells =[,]; var TableRowName =[,]; var TableColName =[,]; for( var i =0; i devList.length; i++) { // set the path var path = prefix + yield_dir + devList[i] +'/' + smslot_yield; //clear the display area $('#display').html(); var colName =[]; var rowName =[]; var cellValue = []; //load the page but collect the table info if (firstLoad == 1) { $('#display').load(path, function(){ manipulate tables and put data in Global Array TableCells[i] = cellValue; TableRowName[i] = rowName; TableColName[i] = colName; }); } } }); So the variables are defined in the document ready scope. (I even tried outside that as well) var TableCells =[,]; var TableRowName =[,]; var TableColName =[,]; I set these variables in the load function scope and they are accessible there and work fine. However when I try to access outside the load function the variables are undefined. Can you tell what I am missing? Thanks, Steve
[jQuery] val ( ) prefers labels over values?
Consider the following select box: select id=test option value=/option option label=XS value=1XS/option option label=S value=2S/option option label=M value=3M/option option label=L value=4L/option option label=XL value=5XL/option option label=0 value=60/option option label=1 value=71/option option label=2 value=82/option option label=3 value=93/option option label=4 value=104/option option label=5 value=115/option option label=6 value=126/option option label=7 value=137/option option label=8 value=148/option option label=9 value=159/option option label=10 value=1610/option option label=11 value=1711/option option label=12 value=1812/option /select If I do a $(#test).val(2) on this I would hope it would select S, but instead it selects 2. Why is this setting the value of the select box based on the label rather than based on the value attribute? I am using Safari 4, by the way. Thanks
[jQuery] Re: Disable input button, using wrong HTML code?
On May 6, 2009, at 10:59 AM, Stephen Korecky wrote: On May 6, 9:46 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: the 'correct' way is disabled=disabled, though. Jonathan -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be Ah, that makes more sense then, I know the 'correct' way is disabled=disabled which is why I was confused as to why this was even working... If I'm understanding things correctly, the correct value for the HTML attribute is disabled, but for the DOM property, which is what you're really setting with JavaScript, the correct value is a Boolean. If you look in the jQuery core, you'll see that it checks for a true/ false value for the :disabled and :enabled selectors: filters: { enabled: function(elem){ return elem.disabled === false elem.type !== hidden; }, disabled: function(elem){ return elem.disabled === true; }, // and so on } also see: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-642250288 http://msdn.microsoft.com/en-us/library/ms533732(VS.85).aspx In any case, both .attr('disabled', true) and .attr('disabled, 'disabled') should work. --Karl Karl Swedberg www.englishrules.com www.learningjquery.com
[jQuery] Re: Scoping issue with load and call back function.
OK it looks like you have a few things to sort out here. One thing is that you have to remember that load is asynchronous. So when that is fired the rest of your code will continue along its merry way. In other words the loop will keep looping independent of the callback function firing. My hunch is that this will give you unexpected values for the variable [i] in the load callback function. Because of this you will probably have to do some refactoring to get the results you're looking for. Not sure though if you intend to run that load on every iteration of the loop or just the first one. Also you may have left this out, but I see you have a firstload = 1 declaration, but then you don't set it to 0. This could also be messing up your results as it will run every time unless you set it to 0 somewhere. Definitely leave the variable declarations outside document ready as in your second email. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Stever Sent: Wednesday, May 06, 2009 4:31 PM To: jQuery (English) Subject: [jQuery] Re: Scoping issue with load and call back function. Josh thanks for the quick response. I tried putting the variables var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; outside the document ready function. Originally. (not redefined with var inside document ready shown here). script type=text/javascript src=http://www.hou.asp.ti.com/ sparcit_data_reports//js/jquery.js/script script type=text/javascript var devList = [ PART_1 ]; var TableCells=[,]; var TableRowName =[,]; var TableColName =[,]; $(document).ready(function(){ $.ajaxSetup({cache: false}) ; var firstLoad = 1; for( var i =0; i devList.length; i++) { // set the path var path = url + devList[i] ; var colName =[]; var rowName =[]; var cellValue = []; //load the page but collect the table info if (firstLoad == 1) { $('#display').load(path, function(){ manipulate tables and put data in Global Array TableCells[i] = cellValue; TableRowName[i] = rowName; TableColName[i] = colName; }); var lenTable2 = TableColName[i].length; } } }); So where I try to access the new length of TableColName[i] I get that this variable is undefined. Actually while debugging, I find that variable i defined in the loop outside the load, is NOT available inside the load function. It is all very confusing. :-( On May 6, 6:10 pm, Josh Nathanson joshnathan...@gmail.com wrote: When you say you get undefined outside the load function, do you mean outside $(document).ready, or inside $(document).ready? They should not be accessible outside document.ready, because of the closure caused by passing the anonymous function to document.ready, and because you use var to declare them inside that function. If you want them to be accessible globally, you'll have to declare them outside document.ready. -- Josh -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of Stever Sent: Wednesday, May 06, 2009 3:54 PM To: jQuery (English) Subject: [jQuery]Scopingissuewith load and call back function. I am a relative newbie to Jquery and I am getting somescopingissues I can't figure out. I was hoping for some advice. Basically I am trying to load multiple documents that have HTML tables and then parse the tables and redisplay in a new format. Merging elements from the different documents. So basically I build the url path for a set of devices and load them. I thought in the load function I could collect elements into global variables and manipulate in the final document. But is not working. The variables TableCells, TableRowName and TableColName are what I have issues with. $(document).ready(function(){ $.ajaxSetup({cache: false}) ; var TableCells =[,]; var TableRowName =[,]; var TableColName =[,]; for( var i =0; i devList.length; i++) { // set the path var path = prefix + yield_dir + devList[i] +'/' + smslot_yield; //clear the display area $('#display').html(); var colName =[]; var rowName =[]; var cellValue = []; //load the page but collect the table info if (firstLoad == 1) { $('#display').load(path, function(){ manipulate tables and put data in Global Array TableCells[i] = cellValue; TableRowName[i] = rowName; TableColName[i] = colName; }); } } }); So the variables are defined in the document ready scope. (I even tried outside that as
[jQuery] Re: Performance of parent child selector vs .children() method
On May 6, 10:23 am, Adam flynn...@gmail.com wrote: Essentially, I'd like to know if there is any difference between $(div.grandparent div.parent div.child) and $(div.grandparent).children(div.parent).children(div.child) Does anyone know which of these is more performant or preferred when selecting child nodes? Thanks. Best answer is a test: http://jquery.nodnod.net/cases/353 The overhead of multiple returns and function calls when using children () makes quite a difference.
[jQuery] Re: SimpleModal issues... too many scripts?
Close. li#navPhysicians fixed it. I only quickly read your response earlier as I was at work, but at second glance, I realized this is your script. Thanks for a great script, and the assistance to get it working! On May 6, 3:49 pm, Steeleclipse steelecli...@gmail.com wrote: Thanks for your reply. I will try that tonight and post how it goes! On May 6, 3:37 pm, Eric Martin emarti...@gmail.com wrote: I just took a look and it looks like the main issue is that you are not binding the link correctly. You need to modify the selector in confirm.js from: $('#confirmDialog input.confirm, #confirmDialog a.confirm').click (function (e) { ... }); to: $('#navPhysicians a.confirm').click(function (e) { ... }); HTH On May 6, 10:53 am, Steeleclipse steelecli...@gmail.com wrote: Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance!
[jQuery] Re: Performance of parent child selector vs .children() method
On May 7, 11:54 am, Ricardo ricardob...@gmail.com wrote: On May 6, 10:23 am, Adam flynn...@gmail.com wrote: Essentially, I'd like to know if there is any difference between $(div.grandparent div.parent div.child) and $(div.grandparent).children(div.parent).children(div.child) Does anyone know which of these is more performant or preferred when selecting child nodes? Thanks. Best answer is a test: http://jquery.nodnod.net/cases/353 The overhead of multiple returns and function calls when using children () makes quite a difference. The overhead of such queries is even more significant if plain old javascript (POJS) is also considered. That test page shows the CSS selector takes half the time of children(), but a POJS vesion takes between 1/3 and 1/5 the time of the selector. If performance matters, POJS wins. -- Rob
[jQuery] Re: barackslideshow effect in jquery.
hey jack thanks..but i knew about this. i tried but cannot make it work.. i was wondering if there is any such plugin in jquery. Actually i have some links and corresponding to links are images. i want to fade in the images on mouse hover over the links. also it should changes automatically when no actions taking place. thanks On Wed, May 6, 2009 at 9:37 PM, Jack Killpatrick j...@ihwy.com wrote: maybe this: http://devthought.com/blog/projects-news/2008/06/barackslideshow-an-elegant-lightweight-slideshow-script/ - Jack idrish laxmidhar wrote: hi all..i am looking for a similar effect like the barackslideshow effect. can anyone suggest such a plugin in jquery. thanks a lot -- BEST WISHES. I |) r I |-|
[jQuery] Re: Disable input button, using wrong HTML code?
On May 7, 12:46 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: Stephen Korecky wrote: I tried that too, has same results... On May 6, 9:35 am, Jonathan Vanherpe (T T NV) jonat...@tnt.be wrote: stephen wrote: I created a test page here:http://clients.stephenkorecky.com/stephen_korecky/js_test.html But basically the problem is that $(#button).attr(disabled,true); should disable a input button, and it does, HOWEVER it outputs disabled= when it should output disabled=disabled anyone know how to fix this? $(#button).attr(disabled,disabled); -- Jonathan Vanherpe - Tallieu Tallieu NV - jonat...@tnt.be If you're talking about what you see in Firebug: this just shows Gecko's internal DOM tree, which isn't necessarily the same as how the w3c would like it to be. If you change your html to be input disabled=disabled /, you'll see that firebug will drop the value too. Most browsers just ignore the value of disabled and just look at the existence of the attribute Probably because that is what the HTML specification tells them to do. :-) The OP has an XHTML doctype, but is serving the document as text/ html. The document is treated as HTML, any attempt to set a value for the disabled attribute is ignored as junk. The presence of the attribute is sufficient to disable the element. The document isn't valid XHTML anyway: URL: http://validator.w3.org/check?uri=http%3A%2F%2Fclients.stephenkorecky.com%2Fstephen_korecky%2Fjs_test.htmlcharset=(detect+automatically)doctype=Inlinegroup=0 (which you'll have to keep in mind when you use jquery to reenable the button, you'll need to remove the attribute, not just set it to false). the 'correct' way is disabled=disabled, though. Correct if that is being done in XHMLT markup, but not through DOM. If setAttribute could be relied upon, and you were in fact dealing with an XML document, the correct way would be: element.setAttribute('disabled', 'disabled'); However, setAttribute is broken in some browsers and therefore should be avoided in HTML documents. The simplest, cross-browser way is to set the DOM property to true or false. -- Rob
[jQuery] Re: The jQuery Object, Namespaces, and Program Modules -- Connecting the Dots Between jQuery and Javascript
5) learn to depend on firebug. its an extension to firefox as a plugin and even though safari 4 beta , ie8, and opera 10 all have built-in debugging environments, firebug is still the best. i have a feeling it will be built into firefox soon too. you can inspect the live dom, any elements compiled css hierarchy ( including showing what was overrided based on weight of selector ), network activity including headers of ajax calls and responses, dom properties of seleted elements, a logging hook, a full-fledged (better-than-visual-studio-by-miles ide for debugging step-by-step if you need to) etc http://getfirebug.com/ On Wed, May 6, 2009 at 6:13 PM, kiusau kiu...@mac.com wrote: On May 6, 10:34 am, dhtml dhtmlkitc...@gmail.com wrote: var time = new (function(x){ this.timeStamp = +new Date; this.end = new Date(x); // Invalid Date. })(Infinity); How do you explain that both time.timeStamp and time.end are returned without error in the following: var time = new (function(x){ this.timeStamp = + new Date; this.end = new Date(x); // Invalid Date. })(1241646503107); alert(time.timeStamp); alert(time.end); but the following results when no integer is entered: 1) (time) // invalid date, with no error 2) () // invalid date with no error 3) (time.timeStamp) // error 4) (time()) // error REFERENCE: http://homepage.mac.com/moogoonghwa/practice/JavaScript/js_parentheticalOperator.html -- Christopher Thatcher
[jQuery] what happened to galleriffic?
Hi, Does anyone know if the galleriffic plugic is available somewhere new? I started a project with it last week, pulled from here: http://www.twospy.com/galleriffic/ but when I went there yesterday it wasn't working and isn't today, either. Thanks, Jack
[jQuery] Re: SimpleModal issues... too many scripts?
No problem and thanks...glad you got it working. ;) On May 6, 7:19 pm, Steeleclipse steelecli...@gmail.com wrote: Close. li#navPhysicians fixed it. I only quickly read your response earlier as I was at work, but at second glance, I realized this is your script. Thanks for a great script, and the assistance to get it working! On May 6, 3:49 pm, Steeleclipse steelecli...@gmail.com wrote: Thanks for your reply. I will try that tonight and post how it goes! On May 6, 3:37 pm, Eric Martin emarti...@gmail.com wrote: I just took a look and it looks like the main issue is that you are not binding the link correctly. You need to modify the selector in confirm.js from: $('#confirmDialog input.confirm, #confirmDialog a.confirm').click (function (e) { ... }); to: $('#navPhysicians a.confirm').click(function (e) { ... }); HTH On May 6, 10:53 am, Steeleclipse steelecli...@gmail.com wrote: Hi Everyone, I am new to the jquery world, but have found it quite useful... maybe a little too useful. It seems like I have too many scripts running. Is there a way to simplify what I have been doing in the markup to run them? Please take a look and let me know if I can narrow things down: http://woodlandswoundcare.com/test/index.html On to the bigger issue: I am attempting to use the Simplemodal jQuery script(http://www.ericmmartin.com/projects/simplemodal/) on this site as well. I have done (what I believe to be) everything in the example to get it running, but to no avail. I have revised the css and images to match the site, and I am trying to implement the script in a way so when you click on the physicians only tab on the top navigation bar, the modal box comes up warning visitors of the graphic content. The download of the script includes a working example, from which I just cut and pasted the code to make it work, or what I thought would make it work. Would someone to be willing to take a look and see what they could find? Also, if I have been unclear in my description of the issue, please let me know, and I will post anything else you might need to diagnose. Thanks in advance!
[jQuery] Re: barackslideshow effect in jquery.
maybe this? http://malsup.com/jquery/cycle/pager5.html lots of demos here: http://malsup.com/jquery/cycle/more.html?v2.23 - Jack idrish laxmidhar wrote: hey jack thanks..but i knew about this. i tried but cannot make it work.. i was wondering if there is any such plugin in jquery. Actually i have some links and corresponding to links are images. i want to fade in the images on mouse hover over the links. also it should changes automatically when no actions taking place. thanks On Wed, May 6, 2009 at 9:37 PM, Jack Killpatrick j...@ihwy.com mailto:j...@ihwy.com wrote: maybe this: http://devthought.com/blog/projects-news/2008/06/barackslideshow-an-elegant-lightweight-slideshow-script/ - Jack idrish laxmidhar wrote: hi all..i am looking for a similar effect like the barackslideshow effect. can anyone suggest such a plugin in jquery. thanks a lot -- BEST WISHES. I |) r I |-|
[jQuery] Re: The jQuery Object, Namespaces, and Program Modules -- Connecting the Dots Between jQuery and Javascript
On May 6, 8:06 pm, chris thatcher thatcher.christop...@gmail.com wrote: 5) learn to depend on firebug. It is Firebug that alerted me to the errors. I was hoping that you could explain them. I am still fairly new to Firebug and so far have net learned how to use it to resolve problems -- only detect them. It is does not appear to be as straight forward as the W3C validators that I quickly came up to speed with. Roddy
[jQuery] debugging of selectors
Hey, Any good tips on 'who' to debug selectors? (meaning, when I have some selector like: $('form#someId .someClass') and it don't match what I think it would. I know about the basic stuff that we have in firebug. Thanks, Ido
[jQuery] Re: remote validation
Thanks for your reply. This is what I have. function validateName(button) { txtName.rules('add', { remote: { url: 'validate.ashx' , data: ({id: txtName.attr('name')}) } } , messages: { remote: '* Error' } }); var canSubmit = 0; var ajaxCalled = false; $().ajaxStart(function() { ajaxCalled = true; }); $().ajaxStop(function() { canSubmit = txtName.valid(); if (canSubmit == 1) { // If the remote validation has completed and returns 'true', execute the ASP.NET server-side onClick event of the button __doPostBack(button.id.replace(/_/g,$), ''); } }); var isNameValid = txtName.valid(); return !ajaxCalled isNameValid == 1; } Essentially the method to returns false anytime the remote validation is fired. This is so that my Save button (ASP.NET Link button) does not execute its server-side onClick event prior to the completion of the jQuery's remote validation. On May 7, 1:34 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: Not easy to solve - you could use $().ajaxStop() to wait for the request to finish, then you valid() again, this time it will validate the cached value and return the correct result. Jörn On Wed, May 6, 2009 at 8:00 AM, Mekilioz mekil...@gmail.com wrote: I'm trying to do a jqueryremotevalidationon a 'Name' text field. Thevalidationchecks if the name is unique, hence it has to be done through theremotemethod. 'Save' button onclick is attached to this javascript method function validateName() { txtName.rules('add', { remote: { url: 'validate.ashx' , data: ({id: txtName.attr('name')}) } } , messages: { remote: '* Error' } }); var isNameValid = txtName.valid() return isNameValid; } The problem I have is that .valid() always returns false - because it doesn't wait for theremotevalidationGET to complete. Hence validationfails. Any suggestions? How do people normally doremote validationin jquery? Note: I know for sure that validate.ashx returns true. Thanks in advance.
[jQuery] Re: barackslideshow effect in jquery.
hey jack..thanks a lot..ur reply matches my requirements...it is perfect..i appreciate your help...thanks a lot... On Thu, May 7, 2009 at 8:59 AM, Jack Killpatrick j...@ihwy.com wrote: maybe this? http://malsup.com/jquery/cycle/pager5.html lots of demos here: http://malsup.com/jquery/cycle/more.html?v2.23 - Jack idrish laxmidhar wrote: hey jack thanks..but i knew about this. i tried but cannot make it work.. i was wondering if there is any such plugin in jquery. Actually i have some links and corresponding to links are images. i want to fade in the images on mouse hover over the links. also it should changes automatically when no actions taking place. thanks On Wed, May 6, 2009 at 9:37 PM, Jack Killpatrick j...@ihwy.com wrote: maybe this: http://devthought.com/blog/projects-news/2008/06/barackslideshow-an-elegant-lightweight-slideshow-script/ - Jack idrish laxmidhar wrote: hi all..i am looking for a similar effect like the barackslideshow effect. can anyone suggest such a plugin in jquery. thanks a lot -- BEST WISHES. I |) r I |-| -- BEST WISHES. I |) r I |-|
[jQuery] Re: JQuery Validation plugin with Django (New) Forms (V1.0) - Are these compatible?
Jorn - thanks for the responses - I resolved my problem - for the record I had a mismatch between the versions of JQuery (1.3.2) and an earlier (incompatible) version of the plugin. This was causing some errors that I managed to track down with Firebug. Downloaded the new version of the validation plugin and the behaviour is now what I expect. So it looks like this is nothing to do with Django. Hope this helps someone else in the future. Brendan On May 6, 2:47 pm, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You can set debug:true for debugging. It will always prevent the form submit, which is useful to look at errors that are thrown during validation. Jörn On Wed, May 6, 2009 at 8:37 PM, BrendanC bren...@gmail.com wrote: Jon - Good catch - however that was just a cut/paste problem - below is a new example that does not work as expected - for some reason the validation errors are ignored and the form is posted - not what I was expecting. Is there something else I need to do to prevent form from posting on errors? Why would the validation errors get ignored? Any ideas? TIA !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/ js/jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/ js/jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleDjango JQuery Example/title style type=text/css pre { text-align: left; } label.error { float: top; color: red; padding-left: .5em; vertical- align: top; } /style script id=demo type=text/javascript $(document).ready(function() { // validate signup form on keyup and submit var validator = $(#contact-us).validate({ rules: { subject: required, email:{ required: true, email: true } }, messages: { subject: Enter subject info, email: Enter email info, } }); }); /script /head body div id=main div style=clear: both;/div /div div class=content body bgcolor=#D2FFD2 img src=/media/images/Masthead.png width=942 height=162 form method=post action= id=contact-us h3 Django/JQuery Demo - Get Request /h3 table trthlabel for=id_subjectSubject:/label/ thtdinput id=id_subject type=text name=subject maxlength=100 //td/tr trthlabel for=id_emailEmail:/label/thtdinput id=id_email type=text name=email maxlength=100 //td/tr trthlabel for=id_msgtextText:/label/thtdtextarea id=id_msgtext rows=10 cols=40 name=msgtext/textarea/td/ tr tr td/td td div class=submit input type=submit value=Submit value=update / /div/td /tr /table /form /div /body /html On May 5, 10:35 am, Jörn Zaefferer joern.zaeffe...@googlemail.com wrote: You define rules for a field sender, but there is no input with name=sender. Jörn On Tue, May 5, 2009 at 7:28 PM, BrendanC bren...@gmail.com wrote: JQuery newbie question re using validation plugin with Django newform. I have a simple email feedback contact django form that I wanted to enhance with some JQuery validation. I created a standalone (Non Django) version of the form and it works correctly. However when I create a Django version of the form the validation rules seems to be ignored and the form is always posted - I would expect the form to fail, and never post. One difference (not sure if it's siignificant) is that the Django forms are created from classes/ templates and render as tables. However the exact same HTML code works for the basic form. I'm now thinking that there must be something different re how the submit is being processed for the Django form - but I'm stumped. Anyone got any ideas/things to try? TIA, Brendan Below is a simplified code (both Basic and Djange versions) sample stripped to one validation field: Basic version of the form (working): !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1 / script type=text/javascript language=javascript src=/media/js/ jquery-1.3.2.js/script script type=text/javascript language=javascript src=/media/js/ jquery.validate.js/script meta http-equiv=Content-Language content=en-us / meta http-equiv=Content-Type content=text/html;