Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6757897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:42:37+00:00 2026-05-26T13:42:37+00:00

I am modifying a php login form, adding javascript check form function to it.

  • 0

I am modifying a php login form, adding javascript check form function to it. I wish when users tick the checkbox, the form is true, and when the checkbox is empty, the form becomes false. the codes are like these:-

//the javascript
function check_sli(form,mark,edit){
     if(mark==1 || mark=="all"){
     if(form.terms.value==""){
       sli_check_terms.innerHTML="Please read the terms and conditions first!";
       sli_check_terms.style.height="auto";
       return false;
     }else{
       sli_check_terms.innerHTML="";
       sli_check_terms.style.display = "none";     
     }
   }
}

//the form
<form name="form_sli" id = "form_sli" ACTION="<?php echo $loginFormAction1; ?>" METHOD="POST" onSubmit="return check_sli(form_sli,'all')">

<input type="text" name="login"/><br>
<input type="password" name="password"/><br>

<input name="terms" type="checkbox" id="terms" checked="checked" onBlur="check_sli(form_sli,1)">I have read the terms and conditions<br><div id="sli_check_terms" class="right"></div>

<input type="submit" name="button" id="button" value="Login" />
</form> 

The above codes works normal for textfields, such as when the textfield is empty, the innerHTML pops up. However, when using checkbox, I don’t know the checked and unchecked value, is it 1 vs 0, or !==”” vs ==””??? and shall I use onBlur or onSubmit???

How shall it modify the scripts so that it works for checkbox as well? thanksalot!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T13:42:37+00:00Added an answer on May 26, 2026 at 1:42 pm

    checkboxes use .checked in the dom, which is a bool.

    if (form.terms.checked) {
        ... it's checked ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am modifying my PHP network's code to have user roles like wordpress here
I am having trouble with modifying a php application to have pagination. My error
In the project my team is currently working on, we're modifying a commercial PHP
I'm modifying PHP Markdown (a PHP parser of the markup language which is used
I am modifying a PHP db wrapper for the redis database. Here's how my
I'm trying to set up a simple PHP contact form for a website and
Good day, I am having trouble modifying XML using SimpleXMLElement in PHP. My XML
I have a function i use in modifying my images, and i want to
I have a PHP generated form which consists of a list of items, each
If I have a PHP application which allows users to make changes to documents,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.