SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2004
    Location
    Ireland
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Name Input Problem

    Hi!
    I am writing a JSP application using Struts so I am using Struts JSP tags. I have a tag called <html:text> which is equivalent to <input> tag in JSP. I am having trouble getting the name of this field to use it in JavaScript.
    I am using a map-backed ActionForm in Struts so my the name (or property as its called in Struts) is dynamic. Therefore I have defined it like this.


    <% String propertyName = "value(" + myId + ")"; %>
    <html:text property="<%=propertyName%>" readonly="true" size="2" />

    My JavaScript looks like this:


    function setValue(x){

    document.voteForm.propertyName[x].value = value[i++];
    document.voteForm.SelectionButton[x].disabled = true;

    However document.voteForm.propertyName[x] is null or not an object. Does anyone know what I should call "propertyName[x]" in JavaScript so that it will reference my input field?

    I'd appreciate any help.

    Thanks, B

  2. #2
    SitePoint Member
    Join Date
    Mar 2004
    Location
    Ireland
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hey,
    I managed to get htis fixed. In my <html:text> tag i set styleId to styleId="myStyle" and then I called in like this in my JavaScript

    document.voteForm.myStyle[x].value = value[i++];

    Thanks,

    B


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •