Bump**

On Aug 25, 12:49 pm, raj <nano.ri...@gmail.com> wrote:
> Actually, I think I'm figuring it out. Just a quick question though.
> Is it possible to pass javascript values through the form attrs
> attribute? For example:
>
> class forms(forms.Form):
>     name = forms.TextInput(attrs={'size': 10, 'value': '<?
> js=firstName ?>'',})
>
> On Aug 25, 12:13 pm, raj <nano.ri...@gmail.com> wrote:
>
>
>
>
>
>
>
> > Let me be a bit more clear.
> > Lets take, for example, the linkedin javascript api. Now, when you log
> > into your linkedin account through my website, the website can access
> > certain parts of your profile using javascript. Now, when the user
> > first logs in, I want to be able store some information about the user
> > in my database. So, if the user decides to create an article or
> > something on my website, his article can be attributed to that
> > account. Otherwise, I don't see any other way to attribute data to
> > that user. I don't really know how to pass what the javascript return
> > back into the view.
>
> > On Aug 25, 2:08 am, Daniel Roseman <dan...@roseman.org.uk> wrote:
>
> > > On Thursday, 25 August 2011 06:10:38 UTC+1, raj wrote:
>
> > > > I'm trying to set a default form value in the template, and not in the
> > > > forms.py file (because I'm trying to make the default value dynamic
> > > > depending on something that javascript will return).
> > > > So To test it, I have the following line in my template:
>
> > > > {{ form.first_name|default:"Enter Your first name" }}
>
> > > > The issue is that it doesn't work, And I can't figure out why. Am I
> > > > doing something illegal?
> > > > Help Please. Thank you.
>
> > > No, that doesn't work at all, and never will. The "default" filter is for
> > > providing a value in case a particular context variable is empty, not for
> > > setting a form field's default value.
>
> > > Your reasoning doesn't seem to make sense, in any case. Templates are
> > > rendered server-side, so Javascript can have no effect on what is 
> > > rendered.
> > > Do this in the view.
> > > --
> > > DR.

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to