[jQuery] Re: Best practice for integrating server-side validation (jsp) with jquery validation (specially bassistance)

2009-07-15 Thread Anoop kumar V
OK - this is the approach I intend to take. Please let me know if I am on the right path - or any links or pointers would also help. My application is currently a jsp page that shows some tabs. Each tab is an object that has various properties like name, code, id etc. Clicking on each tab brings

[jQuery] Re: Best practice for processing JSON quickly

2009-03-03 Thread Michael Geary
That "for( i in items )" loop isn't guaranteed to enumerate the items in any particular order. If you need something to be in a particular order, don't use an object with string property names. Use an array, e.g. var items = [ "1010101001010102011010100010101020101020101010101100110

[jQuery] Re: Best practice for processing JSON quickly

2009-03-03 Thread Dave Methvin
> Another thought is that you could just do a replace on 0, 1 and 2 in the > string: replace each number with the div you want, then wrap that in a div. Yeah, I was wondering whether the regexp engine would be faster. Something like this: for(var item in items){ html.push( '', process(

[jQuery] Re: Best practice for processing JSON quickly

2009-03-03 Thread Jack Killpatrick
Another thought is that you could just do a replace on 0, 1 and 2 in the string: replace each number with the div you want, then wrap that in a div. - Jack Jack Killpatrick wrote: assuming that your json items are objects, try this. The console statements are for Firebug output: comment them

[jQuery] Re: Best practice for processing JSON quickly

2009-03-03 Thread Jack Killpatrick
assuming that your json items are objects, try this. The console statements are for Firebug output: comment them out if you don't have firebug. This uses a few speed tricks. // sample data // var items = {}; items["1"] = '101010100101010201101010001010

[jQuery] Re: Best practice for processing JSON quickly

I'm not sure if it matters in javascript but I would do this: var length = item.length; for ( var g = 0; g < length; g++) { Instead of this: for (var g=0; g wrote: > > Not sure how much it'll speed up, but instead of: > item.substr(g,1) > try: item[g] > > Then, go through this post: > h

[jQuery] Re: Best practice for processing JSON quickly

Not sure how much it'll speed up, but instead of: item.substr(g,1) try: item[g] Then, go through this post: http://www.learningjquery.com/2009/03/43439-reasons-to-use-append-correctly ( http://groups.google.com/group/jquery-en/browse_thread/thread/9889ebd5e10c9122 ) Instead of concatenating stri

[jQuery] Re: Best practice for replacing inline HTML function calls w/several arguments with an event handler

James wrote: I think a good way is to put the data into a separate JSON object and give them a unique ID (eg. item01, item02...), and assign that ID somewhere on the links to be clicked. var productList = { 'item01':{name:123-ABC, color:'red', price:9.99}, 'item02':{name:123-ABC, color:'blu

[jQuery] Re: Best practice for replacing inline HTML function calls w/several arguments with an event handler

And as an aside, I sure hope you aren't depending on the price given in the html to be sent back to the server as the price to charge for an item. You could end up selling a lot of $10 items for a penny apiece when a hacker changes the values before submitting the form. On Feb 13, 6:08 pm, RobG

[jQuery] Re: Best practice for replacing inline HTML function calls w/several arguments with an event handler

Eric P wrote: > Hi, > > I'm fairly new to jQuery (been using a few months now). Binding event > handlers to HTML objects via jQuery is awesome, > but I find myself struggling to find a solid (I.e., best practice) method for > getting numerous arguments to the event > handler that are pertine

[jQuery] Re: Best practice for replacing inline HTML function calls w/several arguments with an event handler

I think a good way is to put the data into a separate JSON object and give them a unique ID (eg. item01, item02...), and assign that ID somewhere on the links to be clicked. var productList = { 'item01':{name:123-ABC, color:'red', price:9.99}, 'item02':{name:123-ABC, color:'blue', price:10.99

[jQuery] Re: Best practice to get form field values

Thank you Dan, this looks good. Still wondering, if form field access shouldn't be part of the core. (I need it more frequently than all these slideUpBlendFadeToggle effects ;-) Martin On Jun 12, 9:16 am, mar10 <[EMAIL PROTECTED]> wrote: > Hi, > > what would you consider the 'best practice' to

[jQuery] Re: Best practice to get form field values

My favorite way to get form input values and validate them is by using the each() method. Here's an example: $(function() { $('#myForm input[type=text]').each(function() { switch (this.name) { case 'first_name': // validate the first name input field here

[jQuery] Re: Best practice to get form field values

At the risk of slightly drifting the subject of this thread, I took a look at the demos for the Field plugin: http://www.pengoworks.com/workshop/jquery/field/field.plugin.htm#examples Does anyone know if I can use it to select all of the form fields inside a specific div? IE:           

[jQuery] Re: Best practice to get form field values

Martin, Check out the Field plug-in: http://jquery.com/plugins/project/field This provides the type of functionality you're looking for (of providing form values back for any type of field.) -Dan >-Original Message- >From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On >Behal

[jQuery] Re: Best Practice

On 03/11/2007, Sean Catchpole <[EMAIL PROTECTED]> wrote: >function getRecord(id,URL){ >jQuery("#ResultsTable tr .selected").removeClass("selected"); >jQuery("#"+id).addClass("selected"); > ... > ~Sean I think Sean meant jQuery(#ResultsTable tr.selected")...

[jQuery] Re: Best Practice

I think you got the jist of it. Syntax looks just fine. The filter isn't necessary, but I doubt it will be depreciated in future releases. function getRecord(id,URL){ jQuery("#ResultsTable tr .selected").removeClass("selected"); jQuery("#"+id).addClass("selecte

[jQuery] Re: Best practice for form serialize?

If you know the form name, you have most of what you need. Using jQuery's selectors, get a reference to the form: $("form[name='myform']); Then from there find each of the child form elements (luckily, most form elements are input boxes: $("form[name='myform'] input); Repeat the above for t

[jQuery] Re: Best practice for form serialize?

I was asked why I couldn't just set an action on each field. I can't change the form as it is dynamically created. I just know the form name. In Prototype I used the Form Observer. On Oct 12, 1:07 pm, mo2g <[EMAIL PROTECTED]> wrote: > I have a web page with two forms on it. It originally used Pr

[jQuery] Re: Best Practice? Sliding table rows up and down

One of the issues I ran into with animating tables (specifically, TRs), is that jQuery appears to change the 'display' style from table- row to block while animating, resulting in the row breaking completely while animating, then popping back into place when the animation is complete. I'd love to

[jQuery] Re: Best Practice? Sliding table rows up and down

mber 17, 2007 1:40 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best Practice? Sliding table rows up and down The other issue with table rows is the value applied to the display property when they are shown. IIRC, the display property is reset to block, but this messes up the layout in FF,

[jQuery] Re: Best Practice? Sliding table rows up and down

er 17, 2007 12:14 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best Practice? Sliding table rows up and down Update. I found that one of the reasons the animation was a little choppy was that that I wasn't explicitly defining widths for the TD in my table. Once I defined

[jQuery] Re: Best Practice? Sliding table rows up and down

The other issue with table rows is the value applied to the display property when they are shown. IIRC, the display property is reset to block, but this messes up the layout in FF, because it requires display: table-row to be shown properly. There was an update to jquery.js back in late win

[jQuery] Re: Best Practice? Sliding table rows up and down

lf Of Glen Lipka Sent: Monday, September 17, 2007 10:54 AM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Best Practice? Sliding table rows up and down Often padding, borders and margins get in the way of smooth animation. The same goes for UL structures as Tables. This is part of Box Model

[jQuery] Re: Best Practice? Sliding table rows up and down

Often padding, borders and margins get in the way of smooth animation. The same goes for UL structures as Tables. This is part of Box Model Hell (my own nightmare). Although I REALLY like clean code with virtually nothing in it, I often have to add divs and layer them so that I don't put padding

[jQuery] Re: Best practice for image source change

Thanks a lot tobaco! That's much better! Thanks also to Will Kelly! On Apr 5, 1:36 pm, "tobaco" <[EMAIL PROTECTED]> wrote: > you could this also do it this way: > >

[jQuery] Re: Best practice for image source change

I wrap each thumbnail with a link: This is the amateurish jQuery code I've conjured up: $("a#tnLink01").click(function() { $("#mainImage").attr({src:"another_large_image.jpg"}); }); I'll need one of these functions for every thumbnail and that seems wrong somehow, so I'd really appreciat

[jQuery] Re: Best practice for image source change

you could this also do it this way: $("a.images").click(function() { var large_img = $(this).attr('href'); $("#mainImage").attr('src', large_img); return false; }); this way it's more accessible for users without javascript On 5 Apr., 12:49, "Oddish" <[EMAIL PROTECTED]> wrote: