Javascript populated TextBox reverting on PostBack

  • Thread starter Thread starter Pselus
  • Start date Start date
P

Pselus

I have a form that is built pretty much entirely at run time.

I load a collection of Categories which have multiple Plans.

Each Plan has a RadioButton.

Each Category has a single PriceTag TextBox that is populated with a
Price when a RadioButton is selected. This is done through a
Javascript method.

The PriceTag may be filled out on Page Load depending on whether a
RadioButton was selected the last time they came in to the page and
saved.

If they select a different RadioButton under a Category, the PriceTag
updates correctly through Javascript.

I have multiple CustomValidators on the form.

If the user submits the form and one of these CustomValidators comes
back as InValid on the Server-Side Validation routine the form reloads
itself, and any RadioButtons that were changed are still in the
changed state, but the PriceTag TextBoxes are now repopulated with
what they were when the form first loaded.



I have been through every thing I can think of, working on it for days
and it's driving me insane. Anyone got any advice?



By the way, when I load the RadioButtons and PriceTags I specifically
check to see if it is a Postback...if it is I don't assign any value
to them at all (the values get put back in their by ViewState)
 
most likely the textboxes are disabled. the browser will not postback
any disabled form fields. the easiest workaround is to have the
javascript write the values to a hidden field that will be posted back.

-- bruce (sqlwork.com)
 
The textboxes are not disabled and I actually DO have a hidden field
that the values are being written too.

The problem is that when I re-creating my controls on Postback, during
my PageLoad the new values that the user selected are not in the
textboxes and the old values get assigned to the textbox.

The same problem is happening with some radio buttons I have now.
If I have two radio buttons created dynamically and neither are
checked, when one is checked by the user and they postback, the form
comes back with neither radio button checked again.
 
Back
Top