Re: javascript and form fields
Hello :) > It's 2007. There's better ways of doing these things than littering > your html with event handlers. The way of using of such thing was: ... form.field_name js_fct_string ... js_fct_handler could be something like this: "onclick=some_js_fct(this)" To achieve something like this i have to duplicate code of controls in forms :/ And do some other modifications, I guess. This way seems to me quite usefull, clean and simple. Cheers :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: javascript and form fields
On 02-Feb-07, at 7:11 PM, michelts wrote: > Can someone show an example of django+javascript integration? http://www.b-list.org/weblog/2006/08/05/django-tips-simple-ajax- example-part-2 -- regards kg http://lawgon.livejournal.com http://nrcfosshelpline.in/web/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: javascript and form fields
[EMAIL PROTECTED] wrote: > Not necessarily... You don't have to get them by ID. You can get them > by tagname or, with a simple helper, class name. > Or group them, then cycle through... something like > var controls = > document.getElementById("controls").getElementsByTagName("a") > for(var i=0;i controls[i].onclick ... > > etc. > > Onclick you could get the id or href or whatever you need from that > particular link. > > It's 2007. There's better ways of doing these things than littering > your html with event handlers. > Have a look at JQuery/DOMQuery/Behaviour.js for class-based event handling. Rob :) --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: javascript and form fields
Not necessarily... You don't have to get them by ID. You can get them by tagname or, with a simple helper, class name. Or group them, then cycle through... something like var controls = document.getElementById("controls").getElementsByTagName("a") for(var i=0;i wrote: > Hello. > ahh weekend :) > > On Feb 2, 3:30 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Why does that hurt? Sure is better than having onclick handlers > > littering your html all over the place. > > Well the hurting thing is that You have to be aware of control id. > Besides controlling of many
Re: javascript and form fields
Hello. ahh weekend :) On Feb 2, 3:30 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Why does that hurt? Sure is better than having onclick handlers > littering your html all over the place. Well the hurting thing is that You have to be aware of control id. Besides controlling of many
Re: javascript and form fields
Look at: http://www.b-list.org/weblog/2006/07/31/django-tips-simple-ajax-example-part-1 and http://www.b-list.org/weblog/2006/08/05/django-tips-simple-ajax-example-part-2 Django has quite a bit of things built in that will help you, regardless of which JS library you want to use. On Feb 2, 7:41 am, michelts <[EMAIL PROTECTED]> wrote: > Hi! > > How do you recomend work with javascript and django? There is > documentation for all tasks on django but there is nothing about using > ajax/json/javascript with it. > > I like to use MochiKit and I like to made use of ajax at all, to be > able to do this, I made a helper function called json_to_response that > receive a dict as argument and returns the json result as well. I can > send this helper function if you think necessary. > > Can someone show an example of django+javascript integration? > > Best regards, > > -- > Michel Thadeu Sabchuk > Curitiba - Brasil --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: javascript and form fields
Hi! How do you recomend work with javascript and django? There is documentation for all tasks on django but there is nothing about using ajax/json/javascript with it. I like to use MochiKit and I like to made use of ajax at all, to be able to do this, I made a helper function called json_to_response that receive a dict as argument and returns the json result as well. I can send this helper function if you think necessary. Can someone show an example of django+javascript integration? Best regards, -- Michel Thadeu Sabchuk Curitiba - Brasil --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: javascript and form fields
Why does that hurt? Sure is better than having onclick handlers littering your html all over the place. On Feb 2, 6:27 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi. Is there any clean way to add javascript handler to form field > (subclas of django.forms.FormField)? > > The result should look like: > > > > Right now im using 'ugly' > document.getElementById('id_some_name') . > from template level. But it hurts and is ugly IMHO ;) > > Regards > Michal --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
javascript and form fields
Hi. Is there any clean way to add javascript handler to form field (subclas of django.forms.FormField)? The result should look like: Right now im using 'ugly' document.getElementById('id_some_name') . from template level. But it hurts and is ugly IMHO ;) Regards Michal --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---