[jQuery] Re: My published plugins are not appearing in the jQuery Plugin list

2009-02-24 Thread Dave Stewart

Hey Karl,
That's probably exactly why! I wasn't aware I needed to do this - so I
will organise that now.
Many thanks,
Dave


[jQuery] Re: My published plugins are not appearing in the jQuery Plugin list

2009-02-24 Thread Dave Stewart

Hooray!
That's it sorted. Thanks again Karl :)


[jQuery] Re: My published plugins are not appearing in the jQuery Plugin list

2009-02-23 Thread Dave Stewart

Just heard from someone who found me on Google, but the plugin list
was not mentioned...


[jQuery] My published plugins are not appearing in the jQuery Plugin list

2009-02-19 Thread Dave Stewart

I've had two of my jQuery plugins published for a while now (more than
a year) on teh jQuery site, with backup doumentation and demoes on my
own site.

http://plugins.jquery.com/project/form-highlight
http://plugins.jquery.com/project/Populate

However - they don't appear to show up in the plugins lists:

http://plugins.jquery.com/project/Plugins/category/20?page=1 (Form
Highlight should be here)
http://plugins.jquery.com/project/Plugins/category/20?page=2 (Populate
should be here)

Any ideas?
Thanks,
Dave


[jQuery] Populate plugin updated (plugin to fill forms using JSON)

2008-05-29 Thread Dave Stewart

Hi Everyone,

I've finally updated my Populate plugin, which populates a form using
JSON data.

This plugin supports full PHP hierarchical naming and deep JSON data
structures, as well as checkbox arrays and other non-standard UI
controls. The plugin can be used as part of your AJAX toolkit, or for
separating server-side code from HTML by populating a form after the
page has loaded.

The project homepage is here:


http://www.keyframesandcode.com/code/development/javascript/jquery-populate-plugin/

And I have finally got round to providing demos! Including:

* Populating a simple form, using string variable types for
textfields, radiobuttons, dropdowns and checkboxes
* Populating a complex form, using array variable types for
checkbox arrays and multi-list boxes
* Populating a hierarchical form, using hierarchical JSON data

You can access full instructions and the demo page here:


http://www.keyframesandcode.com/resources/javascript/jQuery/demos/populate-demo.html

If you'd like to report any bugs, or have features included I've not
thought of, please respond via the commenting system on the project
home page.

Cheers,
Dave


[jQuery] Highlight plugin updated (highlight elements and related elements as you interact with them)

2008-05-29 Thread Dave Stewart

Hi Everyone,

I've recently updated my Highlight plugin, which is designed to
increases usability by highlighting elements as you interact with the
page. Its primary use is for forms, but it can also be used for
tables, lists, or any element you specify.

Examples uses:

* Form-filling can be made clearer by highlighting the element
around a control as you tab into it
* Table rows can be made more visible as you pass the mouse over
them, or click them
* Elements can be toggled on and off as you click them

The project homepage is here:


http://www.keyframesandcode.com/code/development/javascript/jquery-highlight-plugin/

And I have finally got round to providing demos! Including:

* Highlighting the areas around form controls as you tab into /
focus upon them
* Highlighting table rows or cells as you rollover them
* Toggling table rows as you click them
* Highlighting list items and sub items as you rollover them

You can access full instructions and the demo page here:


http://www.keyframesandcode.com/resources/javascript/jQuery/demos/highlight-demo.html

If you'd like to report any bugs, or have features included I've not
thought of, please respond via the commenting system on the project
home page.

Cheers,
Dave


[jQuery] Re: Which jquery plugin is best to use to create this effect

2008-02-25 Thread Dave Stewart

You don't need a plugin, just the animate effect:

$('page').animate({left:600}, 1000)


[jQuery] Re: jQuery.validate versus jQuery.yav

2008-02-25 Thread Dave Stewart

I love validate. It takes a bit of getting used to the options, but
it's great.
I attach a custom attribute to any items i want validated with simple
rules, then validate does the rest.

A rough example:

input id=email name=email type=text validation=required:true,
email:true /
label class=error for=emailAny error messages will go here.../
label

$('#form-1').validate()


[jQuery] Re: trying to find the first instance of a person's name on the page

2008-02-24 Thread Dave Stewart

Hey Stephen,
RegExps are always going to be slower than a basic indexOf, so perhaps
when you loop through the names you could try running an indexOf
first, then if it comes out positive, only then do you the RegExp
replacement.

I imagine that there would be a cutoff point where the performance
increase would or would not be apparent.

Glad to help!

:D


[jQuery] Re: trying to find the first instance of a person's name on the page

2008-02-24 Thread Dave Stewart

As well, when your name list gets rather large, I'm sure other pre-
processing routines could speed things up.
For example, you could split the XML list into 26 sections, based on
First Name, then text the html for which Capital letters it contains.
You then only loop through again for those names which contain those
capital letters.

I'm sure there's lots of other optimization routines out there too,
like B-Trees (http://en.wikipedia.org/wiki/B-tree) and what have you.



, then only for those which show up do you run th

On Feb 24, 4:21 pm, sspboyd [EMAIL PROTECTED] wrote:
 Dave, That is great! Thanks.
 I've tested it out with an array of 1000 names as a worst case
 scenario and it is pretty slow. I'll have to see about refining the
 list of names if possible to keep it as small as possible.

 Thanks again,
 Stephen

 On Feb 23, 7:16 pm, Dave Stewart [EMAIL PROTECTED]
 wrote:

  Heh heh, this is cool!

  var names = ['Stephen Boyd','Fred Von Brown']
  $(body).each(
  function(){
  var html = $(this).html()
  $(names).each(
  function(i, e){
  var rx= new RegExp(e, 'gi')
  html = html.replace(rx, 'a href=javascript:void(0);
  onclick=alert(this.innerHTML)' +e+ '/a')
  }
  )
  $(this).html(html)
  }
  )


[jQuery] Re: Can jQuery create Drop Caps?

2008-02-24 Thread Dave Stewart

Yup - you need jQuery and Regular Expressions:

var elements = $('a[class=tablink]')
elements.each(
function(){
var html = $(this).html()
html = html.replace(/([A-Z])/g, 'span class=dropcap$1/
span')
$(this).html(html)
}
)


[jQuery] Re: Can jQuery create Drop Caps?

2008-02-24 Thread Dave Stewart

:)


[jQuery] Re: trying to find the first instance of a person's name on the page

2008-02-24 Thread Dave Stewart

 I was also thinking that the routine you built could be converted into
a search-term highlighter.

There's already a jQuery plugin that highlights, called, conveniently-
enough, highlight!


[jQuery] Mac OS X default system drag and drop is overriding Interface's drag and drop

2008-02-23 Thread Dave Stewart

Hi all,
I'm developing a back end for a photographer's agent, and she wants
the site to be mainly drag 'n' drop thumbnail images, so she can
create collections of various images, by dragging from various bins.

So I've started with a styled ul list of images, and each li
contains an img.
Each img aligns to the middle of it's li so the whole thing looks
like a grid of slides.

I'm using the Interface plugin and it's all working great; I can grab
the lis and it's easy to re-arrange them.


However - with the Mac, when you go to click on the li the browser
intercepts the click on the img and thinks you want to drag the
image to your desktop! Any functionality gained through Interface is
lost.

Does anyone have any solutions? I'm going to look at placing some kind
of div over the top, but I wanted to ask here first.

Cheers,
Dave


[jQuery] Re: Mac OS X default system drag and drop is overriding Interface's drag and drop

2008-02-23 Thread Dave Stewart

[EMAIL PROTECTED] Macs as usual! was my first thought.
But I'm borrowing a Mac laptop to try and check stuff out over the
next few days, so I'll try and keep this thread current and will let
you know
Dave


[jQuery] Re: Mac OS X default system drag and drop is overriding Interface's drag and drop

2008-02-23 Thread Dave Stewart

Yes!
The CSS background image is the way forward.

Thank [EMAIL PROTECTED] for that. A layered-over-the-top-div solution would have
been a complete and horrible hack as far as I'm concerned, so this is
just great.

li.thumbnail{
position:relative;
width:75px;
height:75px;
float:left;
padding:2px;
margin:1px;
border:1px solid #ccc;
background-position:center;
background-repeat:no-repeat;
list-style:none;
}


ul
li class=thumbnail style=background-image: url(../photographers/
jane_patrick/thumbs/bubble.jpg);/
li class=thumbnail style=background-image: url(../photographers/
jane_patrick/thumbs/Bob_Marchant_3.jpg);/
/ul

Hopefully this will help someone else.
Cheers,
Dave


[jQuery] Re: Mac OS X default system drag and drop is overriding Interface's drag and drop

2008-02-23 Thread Dave Stewart

Brainwave: CSS background-image!
I'm going to try this now...


[jQuery] Re: Call a function just before the window close

2008-02-23 Thread Dave Stewart

I couldn't bind 'beforeunload' to the window. document, or body tag
successfully.

I had to revert to a manual 'window.beforeunload'. I know I should be
doing something like

evt = window.attachEvent ? window.attachEvent('onbeforeunload', fn) :
window.addEventListener('beforeunload', fn, false)

but quick and dirty worked for me.

If anyone knows how to do it the jQuery bind way, I'm all ears.

:D


[jQuery] Re: Call a function just before the window close

2008-02-23 Thread Dave Stewart

Well you know - try as I like, I could NOT get the DOM method
addEventListener to work for beforeunload.

Doing it the old way:

window.onbeforeunload = function(){
return Are you sure?
}


[jQuery] Re: Call a function just before the window close

2008-02-23 Thread Dave Stewart

Sorry - text got cut off:

Doing it the old way:

window.onbeforeunload = function(){
return Are you sure?
}

Worked great.


[jQuery] Re: trying to find the first instance of a person's name on the page

2008-02-23 Thread Dave Stewart

Well regexp would be useful if there was a pattern to people's names,
but there isn't.
Do you want to find any names, or a list, or a specific name?





[jQuery] Re: .find does not work in .each

2008-02-23 Thread Dave Stewart

Not sure, but from an id/class point of view, any page id should be
unique, so your order identifier if it is to be used on many TDs,
should really be a class=order.
So if you're just picking up a single id, there's no need to iterate
over, is there?

Anyway - I replicated your test and find worked fine within each for
me.


[jQuery] Re: .find does not work in .each

2008-02-23 Thread Dave Stewart

 it looks like he is trying to find td elements with an id that *starts* with 
 order,

True!

But the jquery was good. So not sure what was going on there.
Sometimes you just need to delete blocks of code and write from
scratch, as you just can't what's not quite right (the brain sees what
it wants to!).
Maybe this is one of those times!


[jQuery] Re: trying to find the first instance of a person's name on the page

2008-02-23 Thread Dave Stewart

Well you could do something like this (it would be prohibitively slow
on 250 names on one page though!!) :

var names = ['Stephen','Fred']
$(body).each(
function(){
var html = $(this).html()
$(names).each(
function(i, e){
var rx= new RegExp(e, 'gi')
html = html.replace(rx, 'b style=color:red' +e+ '/
b')
}
)
$(this).html(html)
}
)

If you want to check this out on this page, load jQuery using my
jQuery Favelet...

http://www.keyframesandcode.com/code/development/javascript/jquery-favelet/

...then copy / paste the code into Firebug and run it there.


[jQuery] Re: trying to find the first instance of a person's name on the page

2008-02-23 Thread Dave Stewart

For only the first name on each page, just remove the 'g' modifier
from the RegExp constructor (I'm sure you know this)


[jQuery] Re: trying to find the first instance of a person's name on the page

2008-02-23 Thread Dave Stewart

Heh heh, this is cool!

var names = ['Stephen Boyd','Fred Von Brown']
$(body).each(
function(){
var html = $(this).html()
$(names).each(
function(i, e){
var rx= new RegExp(e, 'gi')
html = html.replace(rx, 'a href=javascript:void(0);
onclick=alert(this.innerHTML)' +e+ '/a')
}
)
$(this).html(html)
}
)


[jQuery] Re: jQuery won't recognise attribute names containing [square brackets]

2008-02-12 Thread Dave Stewart

I knew about :input, but my brain just pre-supposed it meant only
input elements so I had kind of disregarded them somewhat.
So thanks for pointing that out!


[jQuery] Re: jQuery won't recognise attribute names containing [square brackets]

2008-02-11 Thread Dave Stewart

Hey Marty,
I couldn't live without PHP's square brackets. I just about always
want to split up a form into component parts.
I could easily write something using RegExp to do this for me, but
having it all built in is just lovely.

Great that Rails has it too.

Cheers,
Dave


[jQuery] Re: jQuery won't recognise attribute names containing [square brackets]

2008-02-11 Thread Dave Stewart

Hi Aaron,
Good styles there with the name attribute stuff. Not so good if you
want to grab other entities such as selects, but good to see that it
accepts non-standard characters.


[jQuery] Re: jQuery won't recognise attribute names containing [square brackets]

2008-02-08 Thread Dave Stewart

OK - this is the best I could come up:

function $$(selector, context){
return jQuery(selector.replace(/(\[|\])/g, '\\$1'),
context)
}

$$('#contact[email]')

It adds to the global namespace (so won't work with prototype for
example, which also uses $$) but it does do trick.

Thoughts?


[jQuery] jQuery won't recognise attribute names containing [square brackets]

2008-02-07 Thread Dave Stewart

I'm finding it impossible using jQuery to select any attributes with
square brackets in them.

I'm sure most people know PHP uses square brackets within form element
names to submit multi-dimensional arrays, ie:

contact[name]
contact[email]
contact[telephone]
contact[options][option 1]
contact[options][option 2]
contact[options][option 3]


This is read natively by PHP as:

contact = array (
name,
email,
telephone,
options = array(
option 1,
option 2,
option 3
)
)


In a way, jQuery's refusal to recognise square brackets makes sense,
as it leans towards attribute selectors (which are fantastic tools),
but vanilla getDocuementById() works, so I'm wondering why jQuery
hasn't some kind of check for this kind of thing?

In the meantime, does anyone have any best-practice workarounds to
this issue, for example for the above data structure?

Combined selectors, e.g.

#contact-email

and separate selectors e.g.

#contact #email

offer different advantages. Has anyone any preferences, and why??

Many thanks,
Dave Stewart


[jQuery] Re: jQuery won't recognise attribute names containing [square brackets]

2008-02-07 Thread Dave Stewart

Wow, that's really useful to know, thanks Karl.

I think I'll just use a regular expression:

selector = selector.replace(/(\[|\])/g, '\$1')

It would be really useful if this were an option, somehow. My jQuery-
foo is not all that.

Any ideas, anyone?
Cheers,
Dave


[jQuery] Re: [validate] Validation Plugin - how to remove a control form validation

2008-02-06 Thread Dave Stewart

Hi Jorn,

Sorry for teh delay - was ill yesterday so took a day off.

Well it looks like you've made some amendments to the code, so I don't
think I can reproduce the steps now, but, this is what *did* happen:

1 - new page, no email or password
2 - click Email my password
  - Email validation message is displayed
  - Password validation is hidden
3 - enter email address  password bit now click Login
  - nothing happens
4 - click Login again
  - Password validation message is displayed
5 - Enter password and click Login

Looking forward to what you come up with.

Cheers,
Dave


[jQuery] Re: [validate] Validation Plugin - how to remove a control form validation

2008-02-04 Thread Dave Stewart

Hey Jorn,

Actually the main form image are part of the Art and Science of CSS
book (hell, they published it, so I guess you can) but you could just
specify no bg image and have coloured blocks instead.

The highlight code is mine, but I've updated the first line to cleaner
jQuery to read

var elements = $(input[type!='submit'], textarea, select)

And also, change the page title!

Just checked the code. Looks pretty good, however if the user decides
halfway through that he does remember his password, and clicks
Login, he then has to click it a second time to get the password
validation to kick in. Is there a solution for this?

Looking good though!

:D


[jQuery] Re: [validate] Validation Plugin - how to remove a control form validation

2008-02-02 Thread Dave Stewart

Hi Jorn,
Firstly, thanks for putting the time into this. It is appreciated.

I've updated the live page with some new code that strips the
validation metadata and that portion works great in isolation.

However, it leaves the form exposed if the email address does not
validate the first time, as the password now requires no validation!

Thus you can fail the email the first time (by leaving it blank) and
clicking the Forgot email link, then enter your email and submit.
The password validation has been wiped, so the form will now submit,
password-less! Ouch...

Therefore I attempted to:

1) store the password settings
2) then test-validate the form using $
(#login).validate().form()
3) restore the original settings if teh form fails.

However, this is quite a hacky solution (check the code!). A better
solution perhaps would be to keep all the previously-setup validation
values, and instead set a temporary ignore flag on the password
field.

$(#form).validate({ignore:'#password'})

Then, you just submit as normal, and Validation processes all the
element except the ignored elements.

If the submission fails on any other element all ignored elements are
restored and the form is one again bullet-proof, ready for another
submission.

What do you think?

Cheers,
Dave





On Feb 1, 10:53 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote:
 Dave Stewart schrieb:

  Hi Jorn,
  Yup - here's a test page:

 http://www.janepatrick.co.uk/admin/test/login.php

  Submitting the form manually (as you said) just bypasses any
  validation, which is NOT what I want, as I still need the email
  address validated before it's sent to the back end to email the
  password...

  Using:

  $('#login').submit()

  fires off the validation just fine (but I still need to kill the
  validation on the password field)

  I hope you have enough information now to help me out!

 Ok, I think I found the issue here. Its caused by the metadata plugin,
 which caches the data it reads from the DOM. So setting attr(validate)
 yields nothing, because the validation plugin uses metadata() to access
 the metadata which uses jQuery's data API to cache the value. So in this
 case this removes the required rule from the password field:

 delete $(#password).metadata().required;

 Hope that works for you. Let me know about the results, I'd like to add
 that to a FAQ or as an example in the docs somewhere.

 Jörn


[jQuery] Re: Validation Plugin - Associate array naming with a single error label

2008-02-02 Thread Dave Stewart

Jorn,
I've done some work on selectors for groups, and it's actually quite
easy to select a group or sub group for validation, although I don't
know the details of your implementation, so I wont suppose to imply
anything.

As usual I've uploaded some demo code for you to take a look.

www.janepatrick.co.uk/admin/test/associative-select.php

Hopefully this will save you some thinking time!

Cheers,
Dave


[jQuery] Re: [validate] Validation Plugin - how to remove a control form validation

2008-02-01 Thread Dave Stewart

Hey Jorn,
That's great! As you know I'm a big fan of the plugin :)

You know I've written a whole load of cool helper stuff that works
with validate. Perhaps I should email you, rather than using this
agonisingly slow groups thing...? Let me know if that's cool.

Did you see my other post about validating associative arrays?


http://groups.google.com/group/jquery-en/browse_frm/thread/345f81caf95a163a#

I often pass values to PHP naming my elements like this:

group[property_1]
group[property_2]
group[property_3]

At this time, there's no way to validate a group like this using your
plugin. If you have the time, I'd love you to take a look at the post.

Thanks again!
Dave


[jQuery] Re: Validation Plugin - Associate array naming with a single error label

2008-02-01 Thread Dave Stewart

Jorn,
Here is a live example.

http://www.janepatrick.co.uk/admin/test/associative.php

Hopefully it's in your interest to examine this issue further!
Many thanks,
dave


[jQuery] [validate] Validation Plugin - how to remove a control form validation

2008-01-30 Thread Dave Stewart

Hi there
I'm building a login form, with a Forgot password link. When
clicked, I need to unset some validation options to successfully
submit the form.

The code I'm running does this:

1 - remove the validation constraints from the password field
2 - hide any error messages that were displayed for the password
field
3 - submit the form using form.submit()

However, I can't seem to do either properly. Here's the code I'm
using:

$('#password').attr('validation', '')
$('label.error[for=password]').hide()
$(#login).validate()


The problems are:

1 - form.submit() seems to bypass any of the validation
2 - if I click the submit button manually, the initial validation
kicks in and the password error is re-displayed

Can anyone shed any light on what I should be doing. I'm not sure if
there are already options for this, alrthough I've looked through the
docs several times over.

Thanks,
Dave


[jQuery] Re: [validate] Validation Plugin - how to remove a control form validation

2008-01-30 Thread Dave Stewart

Hi Jorn,
Yup - here's a test page:

http://www.janepatrick.co.uk/admin/test/login.php

Submitting the form manually (as you said) just bypasses any
validation, which is NOT what I want, as I still need the email
address validated before it's sent to the back end to email the
password...

Using:

$('#login').submit()

fires off the validation just fine (but I still need to kill the
validation on the password field)

I hope you have enough information now to help me out!

Cheers,
Dave


[jQuery] Re: Validation Plugin - Associate array naming with a single error label

2008-01-29 Thread Dave Stewart

I made a small discovery (in my sleep no less!) that works in HTML,
but screws up the PHP:

HTML:
If I put the array properties in single quotes (the spaces are to make
it clearer), the controls are validated as a group! This is good.

input type=checkbox name=group[ ' property_1 ' ] /
input type=checkbox name=group[ ' property_2 ' ] /

PHP:
However, the PHP also receives those single quotes, so variable names
now come through like this:

[ ' property_1 ' ] = 1
[ ' property_2 ' ] = 2

This is not good.

Hopefully someone (Jorn!?) will have the solution.
Thanks,
Dave


[jQuery] Re: Google map plugin?

2008-01-29 Thread Dave Stewart

Hi Chris,

The trick to Google Maps (for me at least) was getting to know the
basics of the OOPness of it all.

EVERYTHING (just about) is an object. You rarely pass values, you
normally instantiate objects, then pass them.

For example, in the example Bohdan gave, you would have to 1) create
the Point, then instantiate a 2) new Marker with it, then 3) add the
Marker to the map. (From memory, but you get the idea)

You only need to know a few basic objects, and you're away, although
the size of the API can be overwhelming the basics are easy to get.

Hope that helps.

:D


[jQuery] Re: Parsing XML using jQuery

2008-01-29 Thread Dave Stewart

Thanks David and Tim,
I didn't know that. Very useful.


[jQuery] [validate] Validation Plugin - Associate array naming with a single error label

2008-01-28 Thread Dave Stewart

Hey folks,
I often pass variables to the backend using associative arrays.
However, I can't seem to associate the error label with the group as a
whole, as in HTML Form terms, it's actually 2 separate elements,
rather than array (which PHP sees it as).

label for=group[*wildcard*]Associative Array Test/label
fieldset id=login
labelinput type=checkbox name=group[property_1] value=1
validation=required:true/ Username/label
labelinput type=checkbox name=group[property_2] value=2
validation=required:true/ Password/label
/fieldset
label for=group[*wildcard*] class=errorAt least one option is
required/label

What happens is, the automatic error messaging adds 2 brand new error
messages to each of the elements.

Is there currently a way for the plugin to recognise that the 2 items
ARE in fact an array? Can I use some kind of wildcard or selector in
the for attribute of the error label?

For reference, PHP will see the values like this:

Array
(
[group] = Array
(
[property_1] = 1
[property_2] = 2
)

)

I can upload a live version if necessary.

Cheers,
Dave


[jQuery] Re: Parsing XML using jQuery

2008-01-28 Thread Dave Stewart

Not sure if this is the best reply, but in order to access the
structure, it has to be part of the DOM, so best to inject in into a
placeholder first:

$('#placeholder).html(xml) // probably need to kill the xml
declaration first

Then you can use jQuery to traverse the tree.

:D


[jQuery] Re: How do I stop the form control (but not the label) itself receiving the error class

2008-01-25 Thread Dave Stewart

Jörn, Thanks!

That was what I wanted! A lot of jQuery plugins have so many options
that sometimes it's difficult to see the wood for the trees.

Thanks again for pointing this out
Diego, thank you also for your input into this matter.

Cheers,
Dave


[jQuery] Re: using a different tag than label for error messages

2008-01-25 Thread Dave Stewart

Hi MorningZ,
I just did some quick Googling on the matter, and turned up this
useful link:

http://www.456bereastreet.com/archive/200711/use_the_label_element_to_make_your_html_forms_accessible/

Each label element can only be associated with a single form control,
while a form control may have several labels associated with it. This
could be very useful for displaying hints and error messages since it
would let you separate those messages in the markup for much easier
positioning and styling. Unfortunately my limited screen reader
testing (JAWS 8.0 and VoiceOver) of multiple labels suggests that
screen readers ignore them.

So it appears you are right in your semantics argument! My worry was
that a single label ONLY should be used to describe the form control,
such as Username, and additional labels would only serve to confuse;
for example a user might think a form control had TWO names.

Then again, it appears that screen readers mostly ignore additional
labels.

But I think I'm going to go with labels over divs for the time being.
I now agree that they are the best in this situation, so thanks for
spurring me to look further.

Cheers,
Dave


[jQuery] Re: Scrollable image in a div

2008-01-25 Thread Dave Stewart

Pete,
Great little plugin there! I've done teh same using vanilla
JavaScript; have yet to convert it to jQuery but this is a nice
insight.

One problem (bug) is that you seem to have to click (then it freezes)
then release to move around, then re-click to cancel.

Do you know why the mouse handlers are not responding as they in
theory should?

Cheers,
Dave


[jQuery] Re: [validate] using a different tag than label for error messages

2008-01-25 Thread Dave Stewart

Jörn,
I've just realised that you're the author. Congratulations on a really
great plugin! I was midway through my own validation power-plugin when
I discovered yours - and I'm TOTALLY impressed! So much so that I
shall consign mine to the scrapheap.

It's great that you can override the error element like this. I've
checked and it works great.

But unless I'm mistaken, it's missing from the validation options
documentation!

Cheers,
Dave


On Jan 24, 8:35 pm, Jörn Zaefferer [EMAIL PROTECTED] wrote:
 Dave Stewart schrieb: Hello,
  I'd rather not use label tags for my error messages, as I think
  divs are less semantically ambiguous.
  Is there any way I can change the default functionality?
  At the moment I'm placing my own error divs manually, but I can't
  get them to show unless I change them to labels

 You can override the label via the errorElement option. 
 Seehttp://docs.jquery.com/Plugins/Validation/validate

 Jörn


[jQuery] Re: How do I stop the form control (but not the label) itself receiving the error class

2008-01-25 Thread Dave Stewart

Jörn,
highlight does exactly what I want if I pass it an empty function,
so that's great.
How about adding the option to pass null or false for those times
when you want to do nothing and just let the the error message take
the strain?
Cheers,
Dave


[jQuery] Re: How do I stop the form control (but not the label) itself receiving the error class

2008-01-25 Thread Dave Stewart

Great stuff!
In the meantime I'm looking forward to learning even more about your
fabulous, time-saving plugin.
Cheers!
Dave


[jQuery] Re: pretty urls break my jquery app: how to adapt it ?

2008-01-24 Thread Dave Stewart

Hi Alex,
Amazing project. I'd be interested to know more about the generative
stuff.
How are the particles generated? In Flash?
Cheers,
Dave


[jQuery] [validate] using a different tag than label for error messages

2008-01-24 Thread Dave Stewart

Hello,
I'd rather not use label tags for my error messages, as I think
divs are less semantically ambiguous.
Is there any way I can change the default functionality?
At the moment I'm placing my own error divs manually, but I can't
get them to show unless I change them to labels

Help!

And thanks very much.
Cheers,
Dave


[jQuery] [validate] How do I stop the form control (but not the label) itself receiving the error class

2008-01-24 Thread Dave Stewart

Pretty much sums it up really.
I only want the error label (of class error) to be displayed, but
not the class of the text box or such like to have it's class updated.
Thanks,
Dave


[jQuery] Re: using a different tag than label for error messages

2008-01-24 Thread Dave Stewart

SORRY - the word [jQuery Validation Plugin] was supposed to appear in
the title, but didn't.


Hello Diego,
Sorry, it's a separate question, actually. I've re-stated the first
post question to clarify things, so sorry for the ambiguity.

To restate the problem:

Using the jQuery Validation Plugin, you can associate an element (in
this case a label) with a form element in which you might display an
validation error message when validating the form.

The way how the plugin seems to work is to look for an associated
label using the label's for attribute.
I want to know if I can use any other element, such as a div, rather
than a label, as I'm already using one label.

(I'm going on the premise that having 2 labels would be confusing for
screen readers)

Thanks,
Dave


[jQuery] Re: How do I stop the form control (but not the label) itself receiving the error class

2008-01-24 Thread Dave Stewart

SORRY - the word [jQuery Validation Plugin] was supposed to appear in
the title, but didn't.

To restate the problem:

When I validate a form using the jQuery Validation Plugin, when it
comes across a form element that doesn't validat, it does 2 things:

1. Adds, or shows the corresponding error label tag, and
2. Adds the error class to the form element.

I only want to do the first action, and I don't want the form element
to be altered.

Is this possible?
Thanks,
Dave


[jQuery] getScript Safari fix

2007-07-11 Thread Dave Stewart

I have no idea if this possible solution to making getScript work
across all browsers (including Safari) has already been mentioned, but
I thought I'd provide it in case anyone was looking for a way. I've
seen uses of timeouts and such to try to figure out when a script has
been loaded, but ultimately I think this solution is better. It gets
javascript (and css) by means of AJAX, then dynamically creates style
and script tags and appends the text content of the ajax response. Of
course a few browser specific fixes are incorporated, but that's the
gist of it. I made this plugin for personal use a couple months ago,
and I guess I should have probably shared it back then, but I hope
better late than never.

An example use of this plugin would be:

$(#load).click(function(){
$.include(jqModal.css,jqModal.js,jqDnR-R.js, {onload: function(){
$('div class=jqmWindowdivh3 
style=cursor:moveSuccess!/
h3hr /pIf you\'re reading this message then the test was
successful.../ppYou should be able to drag this box by its title./
pinput type=button value=Close class=jqmClose //div/
div').appendTo(body).jqm().jqDrag('h3').jqmShow().jqmAddClose('.jqmClose');
}});
});

This uses $.include to dynamically load each listed file one after the
other. It might be beneficial because it doesn't load the script for
making jqModal work until it's needed. This might not be the best
example, but it shows what it can do.


/*
 * jQuery.include - A dynamic javascript/css loader plugin for jQuery.
 *
 * Copyright (c) 2007 Dave Stewart [EMAIL PROTECTED], 
http://www.yesterdave.com
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * $Version: 2007.04.27 +r3
 *
 * hard time figuring out a way to ensure js/css is loaded before
proceeding with the next file
 *   - use ajax to get js/css file then inject it in a new script/
style tag
 *
 * hard time trying to figure out why safari wouldn't work with
either:
 *   - script.onload
 *   - script.text
 * finally found http://tobielangel.com/2007/2/23/to-eval-or-not-to-eval
 *   - append javscript text to script tag with
document.createTextNode
 *
 * keep in mind that no two external files should have the same name,
becase path is disregarded
 *
 * Options:
 *   - sync: determines whether or not the files are load
synchronously (Default: true)
 *   - onload: the function to run after all the files are loaded
(Default: null)
 *   - jsBase: the base directory where javascript files are found
(Default: '')
 *   - cssBase: the base directory where css files are found (Default:
'')
 *
 */
(function($){
var list = {};
var queue = [];
var running = false;
var add = function(file, o){
o = $.extend({sync: true, onload: null, jsBase: '', cssBase: 
''}, o
|| {});
fillList();
var files = file.split(',');
var len = files.length;
$.each(files, function(i, file){
file = (file.indexOf('.css')  -1 ? o.cssBase : 
o.jsBase) + file;
var cb = (i == len - 1) ? o.onload : null;
if (!o.sync)
insert(file, cb || function(){}, false);
else
queue.push({file: file, onload: cb});
});
if (!running)
next();
};
var next = function(){
if (queue.length  0) {
running = true;
var item = queue.shift();
var cb = function(){
if (item.onload)
item.onload();
next();
};
insert(item.file, cb, true);
} else
running = false;
};
var insert = function(file, cb, sync){
if (!list[file]) {
list[file] = true;
if (file.indexOf('.css')  -1)
createCSS(file, cb, sync);
else
createJS(file, cb, sync);
} else
cb();
};
var createJS = function(file, cb, sync){
if (!sync) {
$(document.createElement('script')).attr({type: 'text/
javascript', src: file}).appendTo('head');
cb();
} else {
$.get(file, null, function(jsText){
var s = $
(document.createElement('script')).attr('type', 'text/javascript');
if ($.browser.safari)
s.append(document.createTextNode(jsText));
else
s[0].text = jsText;
s.appendTo('head');
cb

[jQuery] Re: getScript Safari fix

2007-07-11 Thread Dave Stewart

Whoops, forgot to mention, I had set up this page to test it:

http://www.conciencia.net/Temp/IncludeTest.htm