473,378 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Javascript populated TextBox reverting on PostBack

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)
Oct 17 '08 #1
2 2358
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)
Pselus wrote:
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)
Oct 18 '08 #2
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.
Oct 20 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Allan M. | last post by:
I have a series of select boxes that must be populated client side, because they interact with each other. The design specification calls for these boxes to be updated without having to make a...
7
by: joey.powell | last post by:
I have a home page with username and password textboxes and a login button for purposes of users being able to log in (forms authentication) directly on the site home page. I also have a dedicated...
13
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
2
by: Phil | last post by:
Hi, There is a label and a textbox. There are two buttons: one HTML (buttonA), the other ASP.NET (ButtonB). Clicking on buttonA starts a javascript function, starting on ButtonB triggers...
1
by: affi | last post by:
Hi all, I m new to javascript and web development for that matter, so, my questions may sound dumb...........but i will really apperciate any solution ASAP as i m facing a deadline............ ...
2
by: wildman | last post by:
RE: Gridview textbox has data check without postback.. javascript? I have a gridview with a textbox. I can set the textbox to autopostback and check for a value in a prerender event to decide if...
6
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>'...
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
2
Frinavale
by: Frinavale | last post by:
JavaScript in ASP.NET Using JavaScript in ASP.NET pages can make your application seem to work faster and prevent unnecessary calls to the server. JavaScript can be used to perform client-side...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.