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

Checkbox Validation

200 100+
Hi, I need to validate the value of checkbox to see if the checkbox has been checked.

I manage to show the value fo checked property
But cant seem to do an If for validation. Please help

This shows me True or False of checbox being checked
Expand|Select|Wrap|Line Numbers
  1. function Validate()
  2. {
  3.  testnew=document.getElementById('VE1077Doc').checked;
  4.  alert(testnew);
  5. }
  6.  
But now putting it in an IF for validation does not work
Expand|Select|Wrap|Line Numbers
  1. function ValidateInitSubmit()
  2. {
  3.  if(document.getElementById('VE1077Doc').checked=="false")
  4.  {
  5.    alert("testnewresulkt");
  6.  }
  7. }
  8.  
Jan 23 '10 #1

✓ answered by RamananKalirajan

Hi Ismail,
The true or false you getting in the alert is of type boolean, no need to give double quotes for true and false... just check like this

Expand|Select|Wrap|Line Numbers
  1. function ValidateInitSubmit()
  2. {
  3.   if(document.getElementById('VE1077Doc').checked==false)
  4.   {
  5.     alert("testnewresulkt");
  6.    }
  7. }
Thanks and Regards
Ramanan Kalirajan

4 2722
ismailc
200 100+
I can do IF not checked

Expand|Select|Wrap|Line Numbers
  1.  IF (!document.getElementById('VE1077Doc').checked)
  2.  
But this does not work & its part of a longer IF statement so cant use the else
Expand|Select|Wrap|Line Numbers
  1.  if (document.getElementById('VE1077Doc').checked)
  2.  
?
Jan 23 '10 #2
RamananKalirajan
608 512MB
Hi Ismail,
The true or false you getting in the alert is of type boolean, no need to give double quotes for true and false... just check like this

Expand|Select|Wrap|Line Numbers
  1. function ValidateInitSubmit()
  2. {
  3.   if(document.getElementById('VE1077Doc').checked==false)
  4.   {
  5.     alert("testnewresulkt");
  6.    }
  7. }
Thanks and Regards
Ramanan Kalirajan
Jan 23 '10 #3
ismailc
200 100+
Thank You very much this works nicely :)

Please help on getting Popup Div main window disabled/ghost affect working
Jan 23 '10 #4
RamananKalirajan
608 512MB
I have updated that.. Please look into it...

Thanks and Regards
Ramanan Kalirajan
Jan 23 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Eric Linders | last post by:
Hi, In my form, I have a checkbox that must be checked in order to process the form. By default, I want it to be checked when the page first appears. I can do that easily enough by hardcoding...
2
by: Czarina | last post by:
hi guys! here I am again, bugging you Here is where my page stands right now: http://www.gainesvillewebs.com/czar...h_results-2.htm The top 2 forms are working just fine, but the bottom one, with...
4
by: David Jubinville | last post by:
Hi All, I recently came across an annoying problem and would greatly appreciate any help someone/anyone could offer. Here we go: 1. We have a 'Checklist' consisting of checkboxes and relating...
3
by: Earl Teigrob | last post by:
I wanted my "Terms and Conditions" Checkbox control to participate in my ASP.NET validation just like all the the other controls on the page. After some time of searching the web for an example of...
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...
1
by: oakura_ape | last post by:
I have inherited a site that I have ported to ASP.Net 2.0 within the site I have a checkbox in a datalist ItemTemplate as such: <TD width="4%"><INPUT class="rach" id="chk_vid" type="checkbox"...
0
by: Ned Balzer | last post by:
I posted this this morning but it never went through, so I am trying again -- apologies for the duplication if so. I need to validate several checkboxes on an asp.net 2.0 page. I don't need to...
1
by: infernodeep | last post by:
Hi, I have a dynamically generated form, and each listing contains a checkbox named 'del'. The users checks the 'del' checkbox next to each listing they wish to delete, and click the submit...
1
by: sureshl | last post by:
Error in client side validation object expected error in this line,--> OnClientClick="return validation1(<%=maxnumber %>); Syntax error : in this line :for(i=0;i<maxno;i++) i want to validate...
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: 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...
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
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...
0
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...
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...

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.