473,416 Members | 1,659 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,416 software developers and data experts.

Checkbox with javascript change - old value in code behind

I have a page that changes an <ASP:Checkbox value based on a user entered
value in a textboxm using client side Javascript.

After my submit is fired the value for the chkMyCB.checked does not get the
latest value of the checkbox.

Does this sound like a posibility and if so how can I force the server to
get the new value from the page?

TIA,
- Marc Castrechini
Nov 18 '05 #1
3 4476
More:
I just realized that I have the checkbox disabled because the user isn't
allowed to change the checked value manually and I don't want the tab stop.

I see now that if the control is enabled the value returns properly.
Javascript allows the value to change even if the control is disabled.

Does anyone know how I can keep the control disabled but get a current
checked value from it? Later in the code I am using that chkMyCB.checked
value.

TIA,
- Marc Castrechini

"Marc Castrechini" <mc@merchantwareh4o3u2s1e.com> wrote in message
news:eX*************@TK2MSFTNGP11.phx.gbl...
I have a page that changes an <ASP:Checkbox value based on a user entered
value in a textboxm using client side Javascript.

After my submit is fired the value for the chkMyCB.checked does not get the latest value of the checkbox.

Does this sound like a posibility and if so how can I force the server to
get the new value from the page?

TIA,
- Marc Castrechini

Nov 18 '05 #2
When you submit a form, the value for the disabled HTML controls are not
posted back to the server.

- You could use an hidden field.
- Or if the user is not allowed to change this (even indirectly), don't try
to update this value but read the original value server side (you knwo the
user can't have changed this value ?)
- Or reenable the field client side just before submitting (probably bad
visually unless you display a please wait message while processing the
values).
- Others ?
--

"Marc Castrechini" <mc@merchantwareh4o3u2s1e.com> a écrit dans le message de
news:%2****************@tk2msftngp13.phx.gbl...
More:
I just realized that I have the checkbox disabled because the user isn't
allowed to change the checked value manually and I don't want the tab stop.
I see now that if the control is enabled the value returns properly.
Javascript allows the value to change even if the control is disabled.

Does anyone know how I can keep the control disabled but get a current
checked value from it? Later in the code I am using that chkMyCB.checked
value.

TIA,
- Marc Castrechini

"Marc Castrechini" <mc@merchantwareh4o3u2s1e.com> wrote in message
news:eX*************@TK2MSFTNGP11.phx.gbl...
I have a page that changes an <ASP:Checkbox value based on a user entered value in a textboxm using client side Javascript.

After my submit is fired the value for the chkMyCB.checked does not get

the
latest value of the checkbox.

Does this sound like a posibility and if so how can I force the server to get the new value from the page?

TIA,
- Marc Castrechini


Nov 18 '05 #3
Thanks for the help. The hidden field idea got me to thinking about using
more Javascript. It will work nicely for me to have the checkbox "appear"
disabled by changing this.checked when they click and disable the tab stop
in ASP.NET

Modified from something found on the web:
Public Sub MakeReadOnly(ByRef CheckBox As CheckBox)

CheckBox.Attributes.Add("onClick", "this.checked=!this.checked;")

CheckBox.TabIndex = -1

End Sub
Web link for source:
http://www.mcse.ms/archive110-2004-6-659756.html

Thanks again,
- Marc

"Patrice" <no****@nowhere.com> wrote in message
news:uE**************@TK2MSFTNGP09.phx.gbl...
When you submit a form, the value for the disabled HTML controls are not
posted back to the server.

- You could use an hidden field.
- Or if the user is not allowed to change this (even indirectly), don't try to update this value but read the original value server side (you knwo the
user can't have changed this value ?)
- Or reenable the field client side just before submitting (probably bad
visually unless you display a please wait message while processing the
values).
- Others ?
--

"Marc Castrechini" <mc@merchantwareh4o3u2s1e.com> a écrit dans le message de news:%2****************@tk2msftngp13.phx.gbl...
More:
I just realized that I have the checkbox disabled because the user isn't
allowed to change the checked value manually and I don't want the tab

stop.

I see now that if the control is enabled the value returns properly.
Javascript allows the value to change even if the control is disabled.

Does anyone know how I can keep the control disabled but get a current
checked value from it? Later in the code I am using that chkMyCB.checked
value.

TIA,
- Marc Castrechini

"Marc Castrechini" <mc@merchantwareh4o3u2s1e.com> wrote in message
news:eX*************@TK2MSFTNGP11.phx.gbl...
I have a page that changes an <ASP:Checkbox value based on a user entered value in a textboxm using client side Javascript.

After my submit is fired the value for the chkMyCB.checked does not
get the
latest value of the checkbox.

Does this sound like a posibility and if so how can I force the server

to get the new value from the page?

TIA,
- Marc Castrechini



Nov 18 '05 #4

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

Similar topics

0
by: claudel | last post by:
Hi I have a newb PHP/Javascript question regarding checkbox processing I'm not sure which area it falls into so I crossposted to comp.lang.php and comp.lang.javascript. I'm trying to...
7
by: Phil Powell | last post by:
I am producing a form using PHP on the back end and Javascript on the front end. The resulting script will come to the browser as follows: <script> <!-- function selectAll() { moveElement =...
4
by: Steph | last post by:
Hello, Can someone tell me the script to use for having a change on the same page when using checkbox function ? For example, i would to check one condition and display dynamically a button...
5
by: Leo J. Hart IV | last post by:
Hello, I'm hoping someone can help me out. I was wondering if the Enabled property of a CheckBox or RadioButton server control is stored in the ViewState. If not, is there some way to to add...
3
by: Julius Fenata | last post by:
Dear all, I have checkbox on my webform, and I want that when I click my checkbox, it should change status between true or false... Here is my code, // Code Behind CheckBox1.Attributes =...
34
by: clinttoris | last post by:
Hello Experts, I have been told to post this in the Javascript forum as I want to do this client side just before my form gets submitted. Once the user clicks the submit button a javascript...
3
by: ccordero | last post by:
Hi! I am working with asp.net 1.1 and javascript. I have a client side checkbox, a client side button, and an asp.net image button. When I check the checkbox, I want the client side button...
0
by: cyberdawg999 | last post by:
Greetings all in ASP land I have overcome one obstacle that took me 2 weeks to overcome and I did it!!!!! I am so elated!! thank you to all who invested their time and energy towards helping me...
3
by: uremog | last post by:
I have a set of of check boxes. onClick, the checkboxes call check_radio and recup_checkbox. the referenced radios function as group selectors. check_radio just unchecks the radios if someone...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.