iterating checkbox values stored in array using EL

iterating checkbox values stored in array using EL

Content Index :

iterating checkbox values stored in array using EL
Tag : java , By : S Hall
Date : November 25 2020, 07:22 PM

No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Check checkbox whose values are stored in an array

Tag : javascript , By : mgaspar
Date : March 29 2020, 07:55 AM
wish of those help Use attribute-value selector as follow
var preSelected = ['module-001', 'module-003', 'module-027'];

var selector = ':checkbox[value="' + preSelected.join('"], :checkbox[value="') + '"]';
$(selector).prop('checked', true);
:checkbox[value="module-001"], :checkbox[value="module-003"], :checkbox[value="module-027"]
var vowels = ['a', 'e', 'i', 'o', 'u'];

var selector = ':checkbox[value="' + vowels.join('"], :checkbox[value="') + '"]';
$(selector).prop('checked', true);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<input type="checkbox" name="aa" value="a" /> A
<input type="checkbox" name="bb" value="b" /> B
<input type="checkbox" name="Cc" value="c" /> C
<input type="checkbox" name="dd" value="d" /> D
<input type="checkbox" name="ee" value="e" /> E
<input type="checkbox" name="ff" value="f" /> F
<input type="checkbox" name="ii" value="i" /> I

stored checkbox values fetch and keep checkbox selected

Tag : php , By : user171555
Date : March 29 2020, 07:55 AM
Hope this helps Simple use IN_ARRAY
$tg = $row['tagpost'];
$tg1 = explode(',', $tg);


foreach($rt as $rtg){
<input type="checkbox" name="postTag[]" value="<?php echo $rtg['tagurl']; ?>"  <?php if(in_array($rtg['tagurl'],$tg1)){ echo 'checked="checked"'; } ?> > <?php echo $rtg['tagName']; ?>


How to output responses based on checkbox values stored in an array?

Tag : javascript , By : Cosmin
Date : March 29 2020, 07:55 AM
wish help you to fix your issue I have persistent checkboxes which represent the days of the week. I was able to store these values in localStorage in an array so that they stay after refresh. , I hope you mean something like this

//function for persistent checkbox     
var formValues = JSON.parse(localStorage.getItem('formValues')) || {};
var $checkboxes = $("#checkbox-wrapper :checkbox");

function outputResult(isWeekday,isWeekend){

  var output = ""
  if( isWeekday && isWeekend ) output = "Both";
  else if( isWeekday ) output = "Weekday";
  else if( isWeekend ) output = "Weekend";
  document.getElementById("output").innerHTML = output;


function checkDay(){

    var isWeekday = false;
    var isWeekend = false;

      if( this.checked ){
        if( this.id == "saturday" || this.id == "sunday" ) isWeekend  = true;
        else isWeekday = true;


function updateStorage(){

    formValues[this.id] = this.checked;

  localStorage.setItem("formValues", JSON.stringify(formValues));


$checkboxes.on("change", function(){

// On page load
$.each(formValues, function(key, value) {
  $("#" + key).prop('checked', value);

How to pass down checkbox values from an iterating table row to an Array in Vue?

Tag : arrays , By : Kristian Hofslaeter
Date : March 29 2020, 07:55 AM
To fix this issue values in your tableBody component is local data, it will not be share between row.
I saw you want to save data to vuex, you might want to implement as below:
            <td><input type="checkbox" :value="id" :checked="isSelected" @click="toggleValue">...</td>

import { mapActions, mapState } from 'vuex'
export default {
props: {
        id: {
            type: String,
            reuired: true
        indId: {
            type: String,
            reuired: true
methods: {
    toggleValue() {
       if (!this.isSelected) {
       } else {

computed: {
  isSelected () {
    return this.selectedValues && this.selectedValues.includes(this.id)
selectValues(state, payload){
  state.selectedValues = state.selectedValues.concat([payload])

deselectValues (state, payload) {
  state.selectedValues = state.selectedValues.filter(item => item !== payload)

Tag : php , By : n1ckless_id
Date : March 29 2020, 07:55 AM
it fixes the issue When I store services and activity then services and activity value store multiple times in the database, I also use implode instead of foreach but that time first service and first activity stored, the following image describes the idea about what I exactly want.
HTML:-<form method='post' id='userform' action='sh.php'> <tr>
<td>Trouble Type</td>
 <input type='checkbox' name="arr[1][service]" value='1'>tds<br>    <br>

<input type='checkbox' name="arr[1][activity][]" value='1'>Return<br>
<input type='checkbox' name="arr[1][activity][]" value='2'>Filling<br>

 <input type='checkbox' name="arr[2][service]" value='2'>Gst<br>    <br>

<input type='checkbox' name="arr[2][activity][]" value='1'>Return<br>
<input type='checkbox' name="arr[2][activity][]" value='2'>Filling<br>

<input type='checkbox' name="arr[3][service]" value='3'>vat<br>    <br>

<input type='checkbox' name="arr[3][activity][]" value='1'>Return<br>
<input type='checkbox' name="arr[3][activity][]" value='2'>Filling<br>
</td> </tr> </table> <input type='submit' name="submit" class='buttons'> 
    foreach ($_POST['arr'] as $input) {

      foreach ($input['activity'] as $activity) {

        $servicevalue = $input['service'];

        $query = "insert into serviceacitivitymap(service_id,activity_id)
        $insert_row=$conn->query($query) or die ($conn->error.__LINE__);
        echo $query;
        echo "<br>";


Related Posts Related QUESTIONS :
  • What code analysis tools do you use for your Java projects?
  • IllegalArgumentException or NullPointerException for a null parameter?
  • How do I configure and communicate with a serial port?
  • What are the different methods to parse strings in Java?
  • Android Broadcastreceiver for other apps install/delete not working
  • Android Studio onClick not working in BindViewHolder
  • How to use Spring Converter for some controllers only?
  • How verify that 3 numbers in sequence are equals?
  • When using .compareTo to compare dates, why doesn't it take Months into account?
  • Does the perfomance of "filter then map" and "map then filter" differ in a Stream?
  • How can I set the initial Delay after pressing the start Button to a specific time (HH:mm:ss) format
  • How to switch between Android devices during the tests
  • How to configure java.util.logging via properties to use standard output?
  • How to iterate through array in order
  • Is there better way of iteration to find the evenly divisible number?
  • How do I avoid using if statements with a large amount of variables in java
  • Writing JUnit test cases for a Spring Boot Service Application with autowired components
  • Cors for GET with Postman not showing headers
  • Printing values in different column same row using APACHE POI
  • Fully decompile java6 web application
  • Passing keycloak configuration parameters in the code rather than reading from application.properties
  • setDataSource() IO exception
  • Unexpected Output while retrieving Data from mongodb and displaying in a csv file?
  • Algorithm for searching a value in two arrays
  • How to avoid casting with generic return values?
  • Java/RegEx - Negation of pattern not working
  • How to split a string to non empty words if it might include a separator like tab on first place
  • Supplier<Sequence<String>> cannot be iterated more than once
  • Why there is only one thread can actually started in @PostConstruct method?
  • Manage CompletionStage inside of Netty handler
  • Url Problem while Developing on Localhost and deploy on Remote Virtual Server
  • How to identify the missing type id in Jackson error?
  • android data binding error: cannot find symbol
  • Spring Boot application with a jar dependency does not run after maven build
  • Spring Data JPA query , filter ? search engine ? JPQL?
  • Why LiveData returns null in ViewModel?
  • what this line of code mean....new URLClassLoader(new URL[0],getClass().getClassLoader());
  • Why do need to use new Random() instead of just Random Randomnum?
  • I want to access zk components from the java file
  • How do I cast FieldValue.serverTimestamp() to Kotlin/Java Date Class
  • Insertion Sort Double Array with User Input - JAVA
  • Creating 2 dimesional array with user input and find sum of specific columns
  • can not get Advertising ID Provider in android
  • Convert list of Objects to map of properties
  • How to represent an undirected weighted graph in java
  • Return values as array from collection
  • ByteBuddy generic method return cast to concrete type
  • ImageView hides the round corners of the parent
  • Is there a way to find setter method by its getter method or vice versa in a class?
  • Get aggregated list of properties from list of Objects(Java 8)
  • Unable to find a document in Mongodb where exact date match in java
  • UsernamePasswordAuthenticationFilter skips success handler
  • Use Java filter on stream with in a stream filter
  • Default Login not successful in spring boot 2.1.7
  • Adding key value pairs from a file to a Hashmap
  • Rub regex: matching a char except when after by another char
  • Convert Base64 String to String Array
  • Escape Unicode Character 'POPCORN' to HTML Entity
  • An empty JSON field which is a boolean/nullable field in Java model, is getting converted as null
  • Mongo java driver cannot find public constructor for interface
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com