473,657 Members | 2,504 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4486
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@merchantwar eh4o3u2s1e.com> wrote in message
news:eX******** *****@TK2MSFTNG P11.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@merchantwar eh4o3u2s1e.com> a écrit dans le message de
news:%2******** ********@tk2msf tngp13.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@merchantwar eh4o3u2s1e.com> wrote in message
news:eX******** *****@TK2MSFTNG P11.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(By Ref CheckBox As CheckBox)

CheckBox.Attrib utes.Add("onCli ck", "this.checked=! this.checked;")

CheckBox.TabInd ex = -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******** ******@TK2MSFTN GP09.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@merchantwar eh4o3u2s1e.com> a écrit dans le message de news:%2******** ********@tk2msf tngp13.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@merchantwar eh4o3u2s1e.com> wrote in message
news:eX******** *****@TK2MSFTNG P11.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
2124
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 construct a checkbox array in a survey form where one of the choices is "No Preference" which is checked by default. If the victim chooses other than "No Preference", I'd like to uncheck
7
1873
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 = eval("document.imageForm.move" + ""); alert(moveElement); if (document.imageForm.select_all.checked) {
4
7288
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 if the condition is checked on the same page. Thanks in advance for your help
5
9156
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 this property to ViewState? If needed, I can give you more info on exactly what I'm trying to do. Thanks,
3
2925
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 = "JSGeneratePackageID()";
34
3788
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 function needs to run and validate all the checkboxes on my form and make sure none of them are unchecked. I suck at Javascript and my problem is 2fold. I have the following code that constructs the checkbox response.write "<input type=checkbox...
3
3205
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 to disable, and I want the same button enebled if I uncheck the checkbox.
0
4092
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 with my problems. Now for my new little problem,I had a problem posting the values from checkbox fields to a database and thats the obstacle I overcame. Now the second part is my new problem is that I want that the next time that page loads for...
3
3681
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 manually selects checkboxes. i think the problem is in the add_selection and del_selection as suggested by the alerts, which are for debugging only. it gets as far as the alert(add/del selection) alerts in FF. all the alert tests pass in IE. as...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8726
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6163
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.