I am not sure exactly what you mean by 'not step on each others toes'
What exactly are you concerned with?  You could very easily have a
form with 4 phone number fields: home, office, mobile, fax; using
jQuery's .class selector i.e. $(".phone").mask("(999)999-9999");
you could find all of the elements with a class "phone" and apply the
mask to them.
on the server-side you would just need to add the class phone to the
appropriate widgets attributes.
hth,
-richard


On 5/7/08, Kevin Monceaux <[EMAIL PROTECTED]> wrote:
>
> Django Fans,
>
> Could someone point me at some examples of custom widgets that use
> jQuery, or other javascript libraries if there's a better choice.  For
> example, if I wanted to create a phone number widget using jQuery's masked
> input plugin, what would be the best way to go about it.  I've just
> started exploring jQuery.  On a plain html page, I've set up a working
> example which basically includes the jquery and jquery masked input
> scripts, then adds something like:
>
> <script type="text/javascript">
>     $(document).ready(function()
>     {
>         $("#phone").mask("(999)999-9999").focus();
>
>     });
> </script>
>
> to the head, and in the body:
>
> <input type="text" id="phone"></input>
>
> which works nicely.  I've searched the newforms documentation a bit but
> I'm not sure how to best create a custom widget that would achieve the
> above.  Specifically, how would one handle including the needed bits of
> javascript in such a way that if multiple widgets were used on the same
> page they wouldn't step on each other's toes?  Will having multiple
> $(document).ready(function(){}); calls on the same page work?  If the
> widget adds the jquery and jquery masked input scripts to a page, how does
> one use multiple widgets without having those scripts included multiple
> times.
>
>
>
> Kevin
> http://www.RawFedDogs.net
> http://www.WacoAgilityGroup.org
> Bruceville, TX
>
> Si hoc legere scis nimium eruditionis habes.
> Longum iter est per praecepta, breve et efficax per exempla!!!
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to