logo
Tags down

shadow

If i load the checkboxes from database, and i uncheck the checkbox after submit it is still checked


By : Shaggy Dancer
Date : September 16 2020, 06:00 AM
will be helpful for those in need It is easier to code complex if this or that or the other type tests as a simple piece of php rather than trying to bury the tests into some html. That becomes unmaintainable very quickly. It is also not recommended to string ternary tests together.
So create an empty variable and then fill it with the checked=checked if the rules say it should be checked
code :
<?php
$chk = '';
// here are the rules for setting the checked attribute
if ( ($extraServices == 'Park') || ($extraServices == 'Park,Electricity') ) { 
    $chk = 'checked=checked';
}
?>
<input type="checkbox" name="services[]" value="Park" <?php echo $chk;?> >


Share : facebook icon twitter icon

Uncheck all checkboxes in repeater except checkbox being checked


By : user1872102
Date : March 29 2020, 07:55 AM
Hope that helps First of all, add some class to all checkboxes of group-with-one-checked to determine it. For example, class="radio-similar".
Then:
code :
$('.radio-similar').change(function () {
  if ($(this).is(':checked')) {
    $('.radio-similar').not(this).removeAttr('checked');
  };
});

JQuery Dropdown checklist uncheck checkbox if there are a certain number of checkboxes already checked


By : user3055931
Date : March 29 2020, 07:55 AM
like below fixes the issue
onItemClick: function(checkbox) {} The onItemClick option defines a callback function invoked when the user clicks on any item. It is called with a single argument which is the dynamically generated checkbox element. The callback can 'reject' the click by throwing any error.
code :
onItemClick: function(checkbox) {
    if($("#ddcl-YOURSELECTID-ddw input:checked").length >=3){
        throw "TOO MANY!";
    }
} 

How to uncheck all checkboxes, if one checkbox checked?


By : user3725470
Date : March 29 2020, 07:55 AM
seems to work fine I have a set of checkboxes, something like this: , Define an id into the any checkbox, like this:
code :
<label class="checkbox-inline">
  <input type="checkbox" id="" value="1"> information
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="" value="2"> information
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="" value="3"> information
</label>        
<label class="checkbox-inline">
  <input type="checkbox" id="any-checkbox" value="4"> any
</label>
    //We use .on to tackle with the dynamic nature of the HTML
    $( "body" ).on( "change", ".checkbox-inline > input[type=checkbox]", function() {
        if ($(this).attr("id") === "any-checkbox") { //Any checkbox tick
            if ($(this).prop("checked")) { //User checked any
                //Other checkboxes are unchecked
                $(".checkbox-inline > input[type=checkbox]:not(#any-checkbox)").prop("checked", false)
            }
        } else { //Other checkbox tick
            if ($(this).prop("checked")) {//User checked another checkbox
                //Any checkbox is unchecked
                $("#any-checkbox").prop("checked", false);
            }
        }
    });
<label class="checkbox-inline">
  <input type="checkbox" id="" name="hairColor" value="1"> information
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="" name="hairColor" value="2"> information
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="" name="hairColor" value="3"> information
</label>        
<label class="checkbox-inline">
  <input type="checkbox" id="hairColor" name="hairColor" value="4" class="any"> any
</label>
   <br> 
<label class="checkbox-inline">
  <input type="checkbox" id="" name="eyeColor" value="1"> eyeColor
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="" name="eyeColor" value="2"> eyeColor
</label>
<label class="checkbox-inline">
  <input type="checkbox" id="" name="eyeColor" value="3"> eyeColor
</label>        
<label class="checkbox-inline">
  <input type="checkbox" id="eyeColor" name="eyeColor" class="any" value="4"> any
</label>

//We use .on to tackle with the dynamic nature of the HTML
$( "body" ).on( "change", ".checkbox-inline > input[type=checkbox]", function() {
    if ($(this).hasClass("any")) { //Any checkbox tick
        if ($(this).prop("checked")) { //User checked any
            //Other checkboxes are unchecked
            $(".checkbox-inline > input[type=checkbox][name=" + $(this).attr("name") + "]:not(.any)").prop("checked", false)
        }
    } else { //Other checkbox tick
        if ($(this).prop("checked")) {//User checked another checkbox
            //Any checkbox is unchecked
            $("[name=" + $(this).attr("name") + "].any").prop("checked", false);
        }
    }
});

Each row in DataTable has checkboxes .How to uncheck the previous checked box, on check of new checkbox


By : Ken
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , On click of Add button, empty row with text box and check box is created. I have to enter the details in text box but only one checkbox should be checked. Now I can check all the check boxes. But if one is checked, other check boxes should be unchecked. , You can achieve this in your toggleCheckBox() method.
code :
    boolean flag; //Global
    String lastChecked=new String();//global

    if(!flag){
        setFlag(true);
        lastChecked=elementName;
        }

    if(flag){
     for (ReturnBody body : returnBodyList) {
                if (body.getElementName().equals(lastChecked)){
                    body.setKeyColumn(false);
                    lastChecked=elementName;
                    }
            } 
       }

How to uncheck a group of checkboxes when another checkbox is checked


By : Wesley Chow
Date : March 29 2020, 07:55 AM
I wish this help you Despite my comment, I built out a fiddle: http://jsfiddle.net/ctnCn/5/
Related Posts Related Posts :
  • Laravel URL redirecting back
  • Authentication in Laravel using 2 tables
  • Problem with DocuSign, migrating from dev environment to prod environent (Go-Live)
  • Laravel - it is looking for a column "deleted_at" even if I didn't created that column
  • how to change max_input_vars value on godaddy server
  • How to clear memory on each execution?
  • Count number of files with certain string in it [PHP]
  • Rewriting HTML anchor using str_replace and regex
  • How to use doctrine with slim framework 4?
  • Php nothing happens when I click login, just removes both fields
  • How to Store multiple values in single field laravel
  • WordPress get last insert id from database
  • how do i go getting this eloquent relationship right?
  • Symfony two services in docker configuration
  • PHP MySQL if date and time unavailable add to alert message
  • Your requirements could not be resolved to an installable set of packages (phpseclib/bcmath_compat)
  • Map associative array to another array php
  • Laravel orderBy highest points
  • Unable to populate cell by zero value from $_GET array
  • PHP downloading will randomly give a network error
  • Shortcode style parsing
  • Data not Inserting In WordPress Database
  • Converting a nested if-else based on range condition into switch statement
  • Why is the use language construct in php unable to see changes in the value of a variable?
  • Laravel + Swift Mailer: Error: no valid recipients
  • Magento 2 installation on Manjaro (Arch Linux) ~ php extension missing
  • How to prevent manually set url in laravel
  • How to enable XDebug in Apache but not in CLI?
  • Redirect to the prev of the prev url
  • how to configure php email in blue host to use mail() function?
  • php variable scope - include/required scripts vs ajax
  • How to write question in Markmail support (i.e. open meeting support)
  • Laravel query not working when using as scope
  • LexikJWTAuthenticationBundle | JwtToken is working but Authentication says "Full authentication is required to acce
  • how can i use variable in where condition ( in clause) in yii2
  • Fix broken unicode escape without leading slash in PHP
  • What is called after a Data Persister on Api-Platform?
  • How can I stop the regex at first match?
  • How can I echo ( php for loop variables ) in html table?
  • Function that echo string then replace letters
  • svg programming, coords are messed up
  • Is there any array function to make array value as key and other value as value of that key?
  • Difference between get_discount_total() and get_total_discount()?
  • Ajax call using Laravel not working when ad blocker is enabled
  • How to create a function that check multiple values passed as an argument
  • Fetch current and next row and compare in a loop
  • How to Import CSV to 'Update' existing record in DB using Laravel
  • PHPMailer doesnt seem to work with Hostgator Hosting
  • Changing file permissions in php
  • index.php page not loading on main domain on a GCE VM instance
  • Prepared Statement Inside Stored Procedure Called by PHP Prepared Statement
  • Insert multiple values as array into one column
  • PHP Convert RGB Array to String variable
  • Restream a Shoutcast/Icecast Stream Using PHP
  • Cannot write to my csv file from Oracle database using PHP
  • How to get data from mysql to the select option in php
  • My JQUERY AJAX success function not working
  • How to use same Blade template for add and edit operation of one controller in Laravel?
  • Two image not create thumbnail at same time in Php
  • Laravel Keep caching though cleared
  • shadow
    Privacy Policy - Terms - Contact Us © 35dp-dentalpractice.co.uk