Afficher un message
Vieux 08/04/2008, 11h57   #2
Andy Dingley
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Need unique ids using include file

On 8 Apr, 11:41, DanWeaver <danofwea...@googlemail.com> wrote:

> I would like the id of each control in the repeated include file to be
> unique


Well you just can't, so find something else to do.

One option is to not use includes, but instead to generate the content
dynamically (trivial bit of PHP loop or something). Then it would be
easy to generate the ids dynamically too.

Alternatively, given that you're already including each include inside
a wrapper that has a unique id, then you could re-write the client-
side JS or the form handler so as not to require unique ids on each
control. Instead they'd have to infer the "identity" of each control
from the unique id of their parent, in combination with some sub-
selector within this, such as the control type and a class name
attached to it that was unique within that parent (but shared with the
other includes).

Of the two, the first is likely to be easiest.
  Réponse avec citation
 
Page generated in 0,04322 seconds with 9 queries