On Wed, Mar 18, 2009 at 9:02 AM, lucas <chizovo...@gmail.com> wrote:
>
> Hi people! i´m generating some input fileds dinamically with
> jquery...
> to generate the input fields i am using this code: $
> ("#newFormField").append('<?php echo $form->input('xxxx',array
> ('label'=>'Nombre'));?>');

PHP doesn't run on the client. How do you suppose a PHP echo is
supposed to work when the page is already loaded in the user's
browser? Just append the HTML elements.

> the problem is that i need to generate the name and the id of the
> input using some jquery global variables... how can i put that
> variables in the form->input? i tried a lot of possible config (the
> one that i know!) but always throw me errors...
> any ideas? Thanks!!!

$javascript->codeBlock("var foo = '${foo}';");

Of course, you'd need to think carefully about the scope these will
ultimately be declared in when PHP completes the page and hands it off
to the browser.

If what you're trying to do is maintain a relationship to an ID for
one of your models, a better way would be to assign your *PHP* ID
value to an HTML element and let jquery grab that to use to create
your new input. I can't be more specific without seeing precisely what
it is you're trying to do.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to