Special characters in form element names

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • RobG

    Special characters in form element names


    I am creating form elements with names that I'd like to reflect th
    Dublin Core metadata set, e.g. DC.Date, DC.Subject, etc.

    However, when I use them with dots, it completely confuses JavaScript
    e.g.

    theFunction(doc ument.forms.for mName.elements. inputName)

    doesn't work if 'inputName' is DC.Date, i.e.

    theFunction(doc ument.forms.for mName.elements. DC.Date)

    I've tried

    theFunction(doc ument.forms.for mName.elements. 'DC.Date')

    and

    theFunction(doc ument.forms.for mName.elements. DC\.Date)

    and also

    var theName = 'DC.Date';
    theFunction(doc ument.forms.for mName.elements. theName);

    but all fail. Is there any way around this?

    PS. Using form elements that match the DC standard names is very
    handy for readability and when passing stuff back to the server


    -
    Rob

  • Michael Winter

    #2
    Re: Special characters in form element names

    On Sat, 21 Aug 2004 22:39:59 -0500, RobG
    <RobG.1bdry1@ma il.forum4design ers.com> wrote:

    [Accessing property names containing invalid characters]

    Read the FAQ.

    <URL:http://jibbering.com/faq/>

    Mike

    --
    Michael Winter
    Replace ".invalid" with ".uk" to reply by e-mail.

    Comment

    • Mick White

      #3
      Re: Special characters in form element names

      RobG wrote:[color=blue]
      > I am creating form elements with names that I'd like to reflect the
      > Dublin Core metadata set, e.g. DC.Date, DC.Subject, etc.
      >
      > However, when I use them with dots, it completely confuses JavaScript,
      > e.g.
      >
      > theFunction(doc ument.forms.for mName.elements. inputName)[/color]

      theFunction(doc ument.forms[formName].elements[inputName])

      You can use some really nasty characters using this format....
      Mick
      [color=blue]
      >
      > doesn't work if 'inputName' is DC.Date, i.e.
      >
      > theFunction(doc ument.forms.for mName.elements. DC.Date)
      >
      > I've tried
      >
      > theFunction(doc ument.forms.for mName.elements. 'DC.Date')
      >
      > and
      >
      > theFunction(doc ument.forms.for mName.elements. DC\.Date)
      >
      > and also
      >
      > var theName = 'DC.Date';
      > theFunction(doc ument.forms.for mName.elements. theName);
      >
      > but all fail. Is there any way around this?
      >
      > PS. Using form elements that match the DC standard names is very
      > handy for readability and when passing stuff back to the server.
      >
      >
      >
      > --
      > RobG
      >[/color]

      Comment

      Working...