Hi Rick,
I am a bit confused, so please correct me if I am wrong.
Were you trying to suggest that I stack all the needed widgets with unique ids somewhere in the mako template and keep them hidden?
Then I can do a getElementById and then unhide them or some thing?
If yes then can you give a small example.
If my understanding is right then it sounds interesting although a bit of a dirty hack. Any ways I don't care that much as long as performance is not hit and my work is getting done.

Happy hacking.
Krishnakant.
On Friday 20 August 2010 12:23 AM, Richard Harding wrote:
On Thu, Aug 19, 2010 at 2:45 PM, Krishnakant Mane<[email protected]>  wrote:
Hello,
Might be this is too easy and I am overlooking some simple solution.
But really, I am not finding a way to include a value from tmpl_context
inside a javascript function.
what if I am creating a form that will have dynamically added rows and each
row has a dropdown list containing some data.
If it was a static form I could just write<input type = ... value =
${c.names}>
this also applies to text entries which might need to hold data received
from the pylons controller action.
so if I were to create form fields inside a javascript function, i will need
to some how access ${c.Whatever}  and get the pre-populated field generated.
Then I can use jquery to perhaps duplicate rows of such form fields.
Is there a way to accomplish this task?
What I've done in this situation is to create a<select
id="some_template">... that is hidden at the bottom of the page. This
is generated by the mako template when the page is loaded.

Your JS can then use that as a model of a select box for the new rows.
You just end up grabbing the node and duplicating it. Since you
mention jQuery check out:
http://api.jquery.com/clone/

This way you store what you need to reuse in the page itself and then
pull it out when you need via the client side JS.

Rick Harding
http://blog.mitechie.com


--
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to