Java

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • checkbox behavior hard to control?

    7 answers - 821 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Hi everyone.
    My question is :
    I have a strange problem with checkboxes in a formBean :
    The form initializes (action /init)
    I validate, get my results
    I get "back", asking /init, everything is fine, the form shows me my
    previous selections but
    when i uncheck or check one of the boxes and validate again, it does
    not update the formbean, i still get the same results as previously.
    Note that this only happens with checkboxes. When i update a text
    field, the results are updated in the correct way.
    Why is that?
    Thanks.
    sorry for the off-topic email previously sent , by the way
    :-s
    Nicolas
    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.1 | | 970 bytes | |

    Nicolas Bizard wrote:
    Hi everyone.

    My question is :
    I have a strange problem with checkboxes in a formBean :
    The form initializes (action /init)
    I validate, get my results
    I get "back", asking /init, everything is fine, the form shows me my
    previous selections but
    when i uncheck or check one of the boxes and validate again, it does
    not update the formbean, i still get the same results as previously.

    Note that this only happens with checkboxes. When i update a text
    field, the results are updated in the correct way.

    Why is that?

    Thanks.

    sorry for the off-topic email previously sent , by the way
    :-s

    Nicolas

    Did you remember to clear the state of the checkbox properties in your
    form bean's reset() method?

    L.

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.2 | | 1713 bytes | |

    I am not sure what "clear the state" means?
    I'm also not sure about what to put in reset(), and when it is executed
    should i include a code like this :

    reset(){
    this.setCheckedField(false);
    }

    It seems that the problem is specific to checkboxes :
    when unchecked, the state is not updated to the bean
    For example, i had this problem before : i had 4 checkboxes, after
    validation, trying to read the value of a "left unchecked" chackbox
    raised a null pointer exception (following code :)

    myBean.get("myUncheckedCheckbox");

    If the 4 checkboxes had been checked, everything was fine If this
    helps to help me ;-)

    2005/12/5, Laurie Harper <laurie (AT) holoweb (DOT) net>:
    Nicolas Bizard wrote:
    Hi everyone.

    My question is :
    I have a strange problem with checkboxes in a formBean :
    The form initializes (action /init)
    I validate, get my results
    I get "back", asking /init, everything is fine, the form shows me my
    previous selections but
    when i uncheck or check one of the boxes and validate again, it does
    not update the formbean, i still get the same results as previously.

    Note that this only happens with checkboxes. When i update a text
    field, the results are updated in the correct way.

    Why is that?

    Thanks.

    sorry for the off-topic email previously sent , by the way
    :-s

    Nicolas

    Did you remember to clear the state of the checkbox properties in your
    form bean's reset() method?

    L.
    --

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
    --
  • No.3 | | 566 bytes | |

    12/5/05, Nicolas Bizard <nicolasb (AT) gmail (DOT) comwrote:
    I am not sure what "clear the state" means?
    I'm also not sure about what to put in reset(), and when it is executed

    Is this a question?

    It seems that the problem is specific to checkboxes :
    when unchecked, the state is not updated to the bean

    Indeed it does not. Search the FAQ for that.

    Michael.

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.4 | | 1241 bytes | |

    Michael Jouravlev wrote:

    12/5/05, Nicolas Bizard <nicolasb (AT) gmail (DOT) comwrote:

    >
    >>I am not sure what "clear the state" means?
    >>I'm also not sure about what to put in reset(), and when it is executed

    >
    >>

    >
    >Is this a question?
    >


    >
    >>It seems that the problem is specific to checkboxes :
    >>when unchecked, the state is not updated to the bean

    >
    >>

    >
    >Indeed it does not. Search the FAQ for that.
    >
    >Michael.
    >
    >
    >To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    >For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
    >


    I am just curious. Does this situation occur with the Multibox tag? I
    guess I don't understand that when you uncheck a checkbox sometime the
    bean is not updated?

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.5 | | 529 bytes | |

    Simonin, Bradley K (Brad) wrote:

    I am just curious. Does this situation occur with the Multibox tag?
    I guess I don't understand that when you uncheck a checkbox sometime
    the bean is not updated?

    It's an HTTP/browser thing. checked checkboxes are sent in a
    request; if a checkbox isn't checked nothing will be sent to the server.

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.6 | | 774 bytes | |

    12/9/05, Simonin, Bradley K (Brad) <brad.simonin (AT) psl (DOT) nmsu.eduwrote:
    I am just curious. Does this situation occur with the Multibox tag? I
    guess I don't understand that when you uncheck a checkbox sometime the
    bean is not updated?

    Unchecked checkboxes are not sent to the server by browser, not even a
    key with empty value. checked ones are sent.

    So, before accepting input you clear checkboxes in your code, then you
    process the request. Whatever checked ones you receive, you set their
    corresponding values in the applicaiton. are left unset.

    Michael.

    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
  • No.7 | | 1206 bytes | |

    Thank you very much. I forgot about that.

    Michael Jouravlev wrote:

    12/9/05, Simonin, Bradley K (Brad) <brad.simonin (AT) psl (DOT) nmsu.eduwrote:

    >
    >>I am just curious. Does this situation occur with the Multibox tag? I
    >>guess I don't understand that when you uncheck a checkbox sometime the
    >>bean is not updated?

    >
    >>

    >
    >Unchecked checkboxes are not sent to the server by browser, not even a
    >key with empty value. checked ones are sent.
    >
    >So, before accepting input you clear checkboxes in your code, then you
    >process the request. Whatever checked ones you receive, you set their
    >corresponding values in the applicaiton. are left unset.
    >
    >Michael.
    >
    >
    >To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    >For additional commands, e-mail: user-help (AT) struts (DOT) apache.org
    >


    To unsubscribe, e-mail: user-unsubscribe (AT) struts (DOT) apache.org
    For additional commands, e-mail: user-help (AT) struts (DOT) apache.org

Re: checkbox behavior hard to control?


max 4000 letters.
Your nickname that display:
In order to stop the spam: 6 + 5 =
QUESTION ON "Java"

EMSDN.COM