Announcement Announcement Module
Collapse
No announcement yet.
XT AJAX - Problem with dynamically hiding/displaying a text box Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XT AJAX - Problem with dynamically hiding/displaying a text box

    I have a requirement of displaying/hiding an additional field in my JSP based upon the user selection of an option of combo box. I am using Spring XT to handle it, but then failing with the problem of multi browser compatibility. The code works fine in IE, but fails in FireFox 2.0.
    Firefox displays the field always.

    The following is the JSP code, by default the field is made as hidden
    Code:
    								<spring:bind path="searchForm.inputFields[${searchRow}].maxValue">
    									<input type="text" name="<core:out value="${status.expression}"/>" value="<core:out value="${status.value}"/>" style=".visibility=hidden"" size="10">
    								</spring:bind>
    and on the event of the combo box, I set the visibility true.
    Code:
    			SetAttributeAction setMaxValueAction = new SetAttributeAction("inputFields["+strRowId+"].maxValue", "style", ".visibility=visible");
    			response.addAction(setMaxValueAction);
    I am sure the problem is with the style attribute.

    Is there any other way to handle it?

    Regards,
    Anshumn

  • #2
    Not sure if this will help, but I generally use the css attribute 'display' if I'm showing/hiding something - 'none' for hidden, '' for shown.

    Also in your style attribute you have ".visibility", is that . at the front meant to be there?

    Comment


    • #3
      Originally posted by Murf View Post
      Also in your style attribute you have ".visibility", is that . at the front meant to be there?
      Thanks, I would check that.

      The actual attribute value which works is style.visibility="hidden" or style.visibility="visible". I had tried giving like this in the jsp and the handler, but this did not work in IE also. But I had earlier tried like this with Javascript (without XT AJAX)and it had worked nicely. So, then I tried all the combinations using XT AJAX and then got style=".visibility=hidden" working, but I was not sure of it. It works like this in IE, but fails in Firefox.

      Thanks!

      Comment


      • #4
        Originally posted by anshumn View Post
        So, then I tried all the combinations using XT AJAX and then got style=".visibility=hidden" working, but I was not sure of it. It works like this in IE, but fails in Firefox.
        I suggest you to use style="display: none;", and then the following XT Ajax actions:
        https://springmodules.dev.java.net/s...entAction.html
        https://springmodules.dev.java.net/s...entAction.html

        Cheers,

        Sergio B.

        Comment

        Working...
        X