You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by av...@za.safmarine.com on 2002/11/11 10:33:41 UTC

/ /OREF:CPT465A7 RE: onchange submit problem

I have been having the same problem with submits from select boxes.
It keeps the old values if the new value is set to a blank option -
the default option for a select box. I have to clear the old values
my self.



|---------+-------------------------------->
|         |           "Andrew Hill"        |
|         |           <andrew.david.hill@gr|
|         |           idnode.com>          |
|         |                                |
|         |           11/11/2002 11:30 AM  |
|         |           Please respond to    |
|         |           "Struts Users Mailing|
|         |           List"                |
|         |                                |
|---------+-------------------------------->
  >-----------------------------------------------------------------------------------------------|
  |                                                                                               |
  |        To:      "Struts Users Mailing List" <st...@jakarta.apache.org>                  |
  |        cc:                                                                                    |
  |        Subject: RE: onchange submit problem                                                   |
  >-----------------------------------------------------------------------------------------------|
|---------+-------------------------------->
|         |                                |
|---------+-------------------------------->
  >-----------------------------------------------------------------------------------------------|
  |                                                                                               |
  |                                                                                               |
  >-----------------------------------------------------------------------------------------------|




Hmm. Thats wierd. The value should be updated before the submit
occurs - Ive
been using similar code myself without troubles.
Is the value submitted in the actual HttpRequest?
(This would indicate a problem with your setter method on the form
rather
than in your jsp).


-----Original Message-----
From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann@t-systems.com]
Sent: Monday, November 11, 2002 17:25
To: 'Struts Users Mailing List'
Subject: onchange submit problem


Hello!

I use the onchange event handler to submit a form if a value in the
select
box is changed.
However, the value doesn't get updated in the form before the submit
occures. The form-bean doesn't get the actual selected value.

<html:select property="selectedLocation" onchange="submit()">
    <html:options collection="locations" property="code"
labelProperty="text" />
</html:select>

What did I forget?


Regards,
Bernhard

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: / /OREF:CPT465A7 RE: onchange submit problem

Posted by Andrew Hill <an...@gridnode.com>.
Ah - well it depends what the blank value is submitting.
I actually have html that looks like
<select name="bob">
<option value="">&nbsp;</option>
</select>
This means that an empty string is submitted for the blank option.
Now if nothing is submitted for a blank option then your setter method for
the field isnt going to be called! -Its the same problem one has with
checkboxes - and you can use the same solution if you wish (which indeed is
what I think you are doing) - ie: clear the field in the reset() method.

-----Original Message-----
From: avasey@za.safmarine.com [mailto:avasey@za.safmarine.com]
Sent: Monday, November 11, 2002 17:34
To: Struts Users Mailing List
Subject: / /OREF:CPT465A7 RE: onchange submit problem



I have been having the same problem with submits from select boxes.
It keeps the old values if the new value is set to a blank option -
the default option for a select box. I have to clear the old values
my self.



|---------+-------------------------------->
|         |           "Andrew Hill"        |
|         |           <andrew.david.hill@gr|
|         |           idnode.com>          |
|         |                                |
|         |           11/11/2002 11:30 AM  |
|         |           Please respond to    |
|         |           "Struts Users Mailing|
|         |           List"                |
|         |                                |
|---------+-------------------------------->

>---------------------------------------------------------------------------
--------------------|
  |
|
  |        To:      "Struts Users Mailing List"
<st...@jakarta.apache.org>                  |
  |        cc:
|
  |        Subject: RE: onchange submit problem
|

>---------------------------------------------------------------------------
--------------------|
|---------+-------------------------------->
|         |                                |
|---------+-------------------------------->

>---------------------------------------------------------------------------
--------------------|
  |
|
  |
|

>---------------------------------------------------------------------------
--------------------|




Hmm. Thats wierd. The value should be updated before the submit
occurs - Ive
been using similar code myself without troubles.
Is the value submitted in the actual HttpRequest?
(This would indicate a problem with your setter method on the form
rather
than in your jsp).


-----Original Message-----
From: Hirschmann, Bernhard [mailto:Bernhard.Hirschmann@t-systems.com]
Sent: Monday, November 11, 2002 17:25
To: 'Struts Users Mailing List'
Subject: onchange submit problem


Hello!

I use the onchange event handler to submit a form if a value in the
select
box is changed.
However, the value doesn't get updated in the form before the submit
occures. The form-bean doesn't get the actual selected value.

<html:select property="selectedLocation" onchange="submit()">
    <html:options collection="locations" property="code"
labelProperty="text" />
</html:select>

What did I forget?


Regards,
Bernhard

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <
mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <
mailto:struts-user-help@jakarta.apache.org>






--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>