You could do that by giving your field a class name (e.g. file-element)
which will be the same regardless of the nesting. Most javascript frameworks
provide a handy implementation of a getElementsByClassName() so you would be
able to select the element easily from js.

Is that what you are after?

On Mon, Jun 9, 2008 at 11:25 AM, Jamie Royer <[EMAIL PROTECTED]> wrote:

>  Hi Everyone,
>
> I'm trying to figure out how to get a field's id using javascript and
> assigning the id to a variable from within ZF.
>
> I have form A that adds sub-form B that adds field F.  When the form
> is rendered field F is named "a[b][f]" with an id of "a-b-f".
>
> I'd like to not hard-code the field id as "a-b-f" so that I can re-use the
> sub-form and nest it at any depth.
>
> I can't figure out how to get the id of the field so that I can manipulate
> it with javascript from the browser.
>
> I create the form in the init() function and this is where I want to add
> javascript using $this->getView()->headScript()->appendFile('file.js') so
> I can keep the javascript associated with a particular sub-form together in
> one place.
>
> Is there a good solution?
>
>
> Thanks in advance,
> Jamie
>
> If it is not obvious, I'm very new to web development - not programming -
> just new to web development.
>



-- 
Amr Mostafa
Head of Software Development, IT Synergy
[EMAIL PROTECTED] http://itsyn.com
+(2012)1700502 +(202)35371020

Reply via email to