Announcement Announcement Module
No announcement yet.
Question on <form:input> tag Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Question on <form:input> tag


    My problem is - I want to take a request parameter and set it on the command object. Now I have a form to fill the other fields of the command object. But the user should not be able to modify the field wich was filled by the request parameter. Thus I thought I could use the 'disable' attribute of the tag to mask it out (just display the value)... The problem is that the command object isn't populated with disabled form tags in the onSubmit() method

    How can I otherwise achieve such a behavior? Thx


  • #2
    So correct me if I'm wrong: you want to display all of the properties from the command object on the form, but when you submit the form, the command object will be updated with all the properties except for one (the one that was set from the request parameter).

    My recommendation would be: just don't use the form:input tag for that one property.

    Are you using SimpleFormController? If so, set the value of that one property in FormBackingObject (getting the value from the request), and then display it by doing something like

    <input type="text" value="${myCommand.myProperty}" />
    or even just
    <p>${myCommand.myProperty}</p> (if the user can't change it, why use an input at all?)

    This way, the value is displayed, but the form field doesn't get bound to the property.

    Make sense? Am I misunderstanding what you want to do?


    • #3
      No, you got me right. Seems I was a little bit to focused on the use of these tags. Thx