Results 1 to 3 of 3

Thread: Question on <form:input> tag

  1. #1
    Join Date
    May 2008
    Posts
    17

    Default Question on <form:input> tag

    Hi!

    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

    Tobias

  2. #2

    Default

    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. #3
    Join Date
    May 2008
    Posts
    17

    Default

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

Posting Permissions

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