Results 1 to 3 of 3

Thread: disabled fields and spring:bind

  1. #1

    Default disabled fields and spring:bind

    I am able to bind bean variables to my html problem comes when they are being submitted. Some bean variables are initialized with 0 and they are disabled as they are binded. Now if user makes any change to fields that are enabled I calculate total and display in these disabled fields. Now when form is being submitted only enabled fields' values are being reflacted but no change for disabled fields. Any idea how to get around this? Any help will be highly appreciated.

  2. #2
    Join Date
    Jul 2005
    Location
    Russia
    Posts
    118

    Default

    disabled fields are not submitted, and there are no work-arounds. But you can define onSubmit function in your form, and enable those disabled fields.

  3. #3
    Join Date
    Oct 2004
    Location
    Herndon, VA, US
    Posts
    648

    Default

    Quote Originally Posted by tatvamasi
    I am able to bind bean variables to my html problem comes when they are being submitted. Some bean variables are initialized with 0 and they are disabled as they are binded. Now if user makes any change to fields that are enabled I calculate total and display in these disabled fields. Now when form is being submitted only enabled fields' values are being reflacted but no change for disabled fields. Any idea how to get around this? Any help will be highly appreciated.
    Try this: bind the same bean variable to both a hidden field and a disabled display field, give the hidden field the name of the actual variable, and give a different name (you don't really care what it is I think) to the display field. That way (hopefully) the hidden field will always be submitted and bound to the bean variable.

    I haven't actually done this myself, just throwing out some idea, so let me know if it works or not.
    --Jing Xue

Posting Permissions

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