Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: How to validate checkbox checked


This question is answered.


Permlink Replies: 3 - Last Post: May 19, 2017 4:07 PM Last Post By: Eitan Arbel
WIHAN KOTZE

Posts: 4
Registered: 5/22/05
How to validate checkbox checked  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 16, 2017 6:01 AM
Hi Guys (envirnoment = Seattle with IW 14.1.1)

How do I validate on form submit button that checkbox is checked

what I did is Button's ScriptEvents onclick is

if (document.getElementById("CHKAGREE").Checked == false) {
alert("YOU DID NOT AGREE TO THE TERMS OF USE");
return false;
}

above did not work so I also tried the following to ensure that i have I singe function to evaluate

form.javascript:

function Validate() {
if (document.getElementById("CHKAGREE").Checked == true) {
alert("YOU DID NOT AGREE TO THE TERMS OF USE");
return false;
}
return true;
}

with button sciptevents onclick as "return Validate() ;"

This did not work either
Any help will be much appreciated. thank you!

Wihan

Edited by: WIHAN KOTZE on Jan 16, 2017 6:01 AM
Luiz Oliveira

Posts: 133
Registered: 8/19/09
Re: How to validate checkbox checked
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 16, 2017 7:19 AM   in response to: WIHAN KOTZE in response to: WIHAN KOTZE
WIHAN KOTZE wrote:
Hi Guys (envirnoment = Seattle with IW 14.1.1)

How do I validate on form submit button that checkbox is checked

what I did is Button's ScriptEvents onclick is

if (document.getElementById("CHKAGREE").Checked == false) {
alert("YOU DID NOT AGREE TO THE TERMS OF USE");
return false;
}

above did not work so I also tried the following to ensure that i have I singe function to evaluate

form.javascript:

function Validate() {
if (document.getElementById("CHKAGREE").Checked == true) {
alert("YOU DID NOT AGREE TO THE TERMS OF USE");
return false;
}
return true;
}

with button sciptevents onclick as "return Validate() ;"

This did not work either
Any help will be much appreciated. thank you!

Wihan

Edited by: WIHAN KOTZE on Jan 16, 2017 6:01 AM

Use your second example and change the name of function Validate to other name, because Validate is already used in Intraweb.

I jus did and it works.

I changed your validate to the next, as well:
if ($("#checkbox").is(":checked")) {
WIHAN KOTZE

Posts: 4
Registered: 5/22/05
Re: How to validate checkbox checked  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 16, 2017 7:44 AM   in response to: WIHAN KOTZE in response to: WIHAN KOTZE
Thank you Luiz !
Eitan Arbel

Posts: 452
Registered: 2/24/13
Re: How to validate checkbox checked  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 18, 2017 8:40 AM   in response to: WIHAN KOTZE in response to: WIHAN KOTZE
.

Edited by: Eitan Arbel on May 20, 2017 2:06 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02