dimanche 31 mai 2015

checkbox Does not work properly on listview

hello brother i have made listview from db ......and i add onitemclicklistener when i click on item it will take me to the next activity and show full detail of item ......i also add checkbox on list view which check the item....but problem is that when i click on checkbox it not work ....but when i click on item it start next activity after it when i back to listview and again click on checkbox then this item checkbox work and not work other....and when i select 2nd item and back then also it checkbox work.......checkbox only work on that item which atlest one time click not directly checkbox work.....

enter code here`enter code here`
public class DataListActivity extends Activity {
    ListView listView;
    SQLiteDatabase sqLiteDatabase;
    FoodDbHelper foodDbHelper;
    Cursor cursor;
    ListDataAdapter listDataAdapter;

    ListDataAdapter dataAdapter = null;
    Button button;
    DataProvider dataProvider;





    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);

        setContentView(R.layout.data_list_layout);





        checkButtonClick();






        listView = (ListView)findViewById(R.id.list_View);
        listDataAdapter = new ListDataAdapter(getApplicationContext(),R.layout.row_layout);
        listView.setAdapter(listDataAdapter);
        foodDbHelper = new FoodDbHelper(getApplicationContext());
        sqLiteDatabase = foodDbHelper.getReadableDatabase();
        cursor = foodDbHelper.getInformations(sqLiteDatabase);
        if (cursor.moveToFirst())
        {
            do {
                String name,quantity,calorie,fat,protein,sugar,vitamins;
                boolean selected = false;
                String names = null;

                name = cursor.getString(0);
                quantity = cursor.getString(1);
                calorie = cursor.getString(2);
                fat = cursor.getString(3);
                protein = cursor.getString(4);
                sugar = cursor.getString(5);
                vitamins = cursor.getString(6);

                DataProvider dataProvider = new DataProvider(name,quantity,calorie,fat,protein,sugar,vitamins,names,selected);

                listDataAdapter.add(dataProvider);

            }while (cursor.moveToNext());
        }


        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent,View view,int position, long id) {

                String name = (String) ((TextView) view.findViewById(R.id.text_dish_name)).getText();
                String quantity = (String) ((TextView) view.findViewById(R.id.text_dish_quantity)).getText();
                String calorie = (String) ((TextView) view.findViewById(R.id.text_dish_calorie)).getText();
                String fat = (String) ((TextView) view.findViewById(R.id.text_dish_fat)).getText();
                String protein = (String) ((TextView) view.findViewById(R.id.text_dish_protein)).getText();
                String sugar = (String) ((TextView) view.findViewById(R.id.text_dish_sugar)).getText();
                String vitamins = (String) ((TextView) view.findViewById(R.id.text_dish_vitamins)).getText();

                String.valueOf(parent.getItemAtPosition(position));



                Toast.makeText(getApplicationContext(),
                        "dish name is : " + name,
                        Toast.LENGTH_SHORT).show();


      CheckBox names = (CheckBox) view.findViewById(R.id.checkBox1);
                listView.setOnItemClickListener(this);
                   names.setOnClickListener(new View.OnClickListener() {
                       @Override
                       public void onClick(View v) {

                           CheckBox checkBox = (CheckBox) v;

                           DataProvider dataProvider = (DataProvider) checkBox.getTag();
                           Toast.makeText(getApplicationContext(),
                                   "Clicked on Checkbox: " + dataProvider.getName() + checkBox.getText() +
                                           " is " + checkBox.isChecked(),
                                   Toast.LENGTH_SHORT).show();
                           dataProvider.setSelected(checkBox.isChecked());

                       }
                   });





                Intent intent=new Intent(getApplicationContext(),Detail.class);
                intent.putExtra("Dish name",name);
                intent.putExtra("Dish quantity",quantity);
                intent.putExtra("Dish calorie",calorie);
                intent.putExtra("Dish fat",fat);
                intent.putExtra("Dish protein",protein);
                intent.putExtra("Dish sugar",sugar);

                intent.putExtra("Dish vitamins",vitamins);

                startActivity(intent);

            }


        });}

        private void checkButtonClick() {

            List list = new ArrayList();

            listDataAdapter = new ListDataAdapter(this,
                    R.layout.row_layout,list);





            Button myButton = (Button) findViewById(R.id.findSelected);
            myButton.setOnClickListener(new View.OnClickListener() {

                @Override
                public void onClick(View v) {

                    StringBuffer responseText = new StringBuffer();
                    responseText.append("The following dishes were selected...\n");




                    ArrayList<DataProvider> list = (ArrayList<DataProvider>) listDataAdapter.list;
                    for(int i=0;i<list.size();i++) {
                        DataProvider dataProvider = list.get(i);


                        if (dataProvider.isSelected()) {
                            responseText.append("\n" + dataProvider.getName()+" : " + dataProvider.getCalorie()+" kcal");
                        }


                    }


                    Toast.makeText(getApplicationContext(),
                            responseText, Toast.LENGTH_LONG).show();

                }
            });


}



}
    public class DataProvider {
    private String name = null;
    private String quantity;
    private String calorie;
    private String fat;
    private String protein;
    private String sugar;
    private String vitamins;
    private String names = null;
    boolean selected = false;

    public String getName(){
        return name;
    }
    public void setName(String name){
        this.name = name;
    }

    public String getQuantity(){
        return quantity;
    }
    public void setQuantity(String quantity){
        this.quantity = quantity;
    }

    public String getCalorie(){
        return calorie;
    }
    public void setCalorie(String calorie){
        this.calorie = calorie;
    }
    public String getFat(){
        return fat;
    }
    public void setFat(String fat){
        this.fat = fat;
    }
    public String getProtein(){
        return protein;
    }
    public void setProtein(String protein){
        this.protein = protein;
    }
    public String getSugar() {return sugar; }
    public void setSugar(String sugar) {this.sugar = sugar ;}
    public String getVitamins() {return vitamins; }
    public void setVitamins(String vitamins) {this.vitamins = vitamins ;}

    public String getNames() {return names; }
    public void setNames(String names) {this.names = names ;}
    public boolean isSelected()
    {return selected;}
    public void setSelected(boolean selected) {this.selected = selected;}


    public DataProvider(String name,String quantity,String calorie, String fat,String protein,String sugar,String vitamins,String names, boolean selected){
        this.name = name;
        this.quantity = quantity;
        this.calorie = calorie;
        this.fat = fat;
        this.protein = protein;
        this.sugar = sugar;
        this.vitamins = vitamins;
        this.names = names;
        this.selected = selected;

    }

    public void add(List list) {

    }
}



    public class ListDataAdapter extends ArrayAdapter {


    List list = new ArrayList();


    public ListDataAdapter(Context context, int resource) {


        super(context, resource);
    }

    public ListDataAdapter(DataListActivity dataListActivity, int row_layout, List list) {

        super(dataListActivity, row_layout, list);
    }


    static class LayoutHandler{
        TextView name,quantity,calorie,fat,protein,sugar,vitamins;
        CheckBox names;

    }

    @Override
    public void add(Object object) {

        super.add(object);
        list.add(object);



    }

    @Override
    public int getCount() {
        return list.size();


    }

    @Override
    public Object getItem(int position) {
        return list.get(position);


    }

    @Override

    public View getView(int position, View convertView, ViewGroup parent) {
        View row = convertView;
        LayoutHandler layoutHandler;
        if (row == null)
        {
            LayoutInflater layoutInflater = (LayoutInflater)this.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            row = layoutInflater.inflate(R.layout.row_layout,parent,false);
            layoutHandler = new LayoutHandler();
            layoutHandler.name = (TextView)row.findViewById(R.id.text_dish_name);
            layoutHandler.quantity = (TextView)row.findViewById(R.id.text_dish_quantity);
            layoutHandler.calorie = (TextView)row.findViewById(R.id.text_dish_calorie);
            layoutHandler.fat = (TextView)row.findViewById(R.id.text_dish_fat);
            layoutHandler.protein = (TextView)row.findViewById(R.id.text_dish_protein);
            layoutHandler.sugar = (TextView)row.findViewById(R.id.text_dish_sugar);
            layoutHandler.vitamins = (TextView)row.findViewById(R.id.text_dish_vitamins);
            layoutHandler.names = (CheckBox) row.findViewById(R.id.checkBox1);

            row.setTag(layoutHandler);


        }
        else
        {
            layoutHandler = (LayoutHandler) row.getTag();

        }
        DataProvider dataProvider = (DataProvider)this.getItem(position);
        layoutHandler.name.setText(dataProvider.getName());
        layoutHandler.quantity.setText(dataProvider.getQuantity());
        layoutHandler.calorie.setText(dataProvider.getCalorie());
        layoutHandler.fat.setText(dataProvider.getFat());
        layoutHandler.protein.setText(dataProvider.getProtein());
        layoutHandler.sugar.setText(dataProvider.getSugar());
        layoutHandler.vitamins.setText(dataProvider.getVitamins());

        layoutHandler.names.setChecked(dataProvider.isSelected());
        layoutHandler.names.setTag(dataProvider);



        return row;
    }




}




datatable with html content

I am using jquery datatable and data input injson format.

$('#newItemBasketTab').dataTable({
  "aaData": result.itembasketdata,
  "aoColumns": 
  [
     {"mDataProp": "nic5dcodename"},
     {"mDataProp": "asiccprodcodename"},
     {"mDataProp": "unit_name"},
     {"mDataProp": "prod_quantity"},
     {"mDataProp": "prod_value"}
  ]
});

Now I want to place a checkbox in first column of datatable and based on an ID field in json data, the checkbox needs to be checked or unchecked. Is it possible to add html content to datatable?




Vb.net program to design a webform which contains checkboxes based on asp.net framework

I have a webform which is designed using asp.net controls , how to code the web form in vb.net ? , also how to add a connection string and data adapter such that when the checkbox is checked the information is updated in an sql table connected through the data adapter, i'm using visual studio 2013. thanks.




JS: looping function through checkbox array not counting properly

I want to validate the input on a series of checkboxes. There must be at least one checkbox selected, otherwise the user gets an alert to select one.However, the alert appears unless all of the checkboxes are selected.

I realize that the issue is how my for loop params are set, but I cannot gigure out how to fix it. PLEASE!!!! help me. Your input and direction is greatly appreciated. Oh, I am very familiar with MDN and the resources there, but they do not have the answer :).

for(var i=0;i<7;i++){
    if( !checkboxes[i].checked ){
        alert( 'You need to select at least one day!');
        checkboxes[i].focus();
        return false;
    }
}




jQuery does not get correctly values of all checked checkbox

I have a list of checkboxes initially checked as follow:

<input type="checkbox" name="capacity" value="16" checked> 16 <br>
<input type="checkbox" name="capacity" value="32" checked> 32 <br>
<input type="checkbox" name="capacity" value="64" checked> 64 <br>
<input type="checkbox" name="capacity" value="128" checked> 128 <br>

Each time a checkbox is checked or unchecked, I want to update the capacity list again, therefore, I use (with a little bit of repeating the code):

$('input[name="capacity"]').change(function() {
   var capacity = $('input[name="capacity"]:checked').map(function() {
        return this.value;
    }).get();
   console.log(capacity);
}

However, the capacity still contains value of last unchecked checkbox. More specifically, when I unchecked 128 -> capacity = ["16","32","64","128"]. Then, I unchecked 32 -> capacity =["16","32","64"]

I don't understand this strange behavior or am I doing something wrong?




How to set @Html.Checkbox() is checked when clicking the text beside?

I have a line which contains a checkbox and a text. Like this: @Html.Checkbox("cb1") @: My checkbox, and the requirement is: When I hover "My checkbox", the checkbox cb1 is hovered. When I click "My checkbox", cb1 is clicked.

I have tried this, but it doesn't work:

<tr>
     <td>@Html.Checkbox("cb1")</td>
     <td><label id="text">My checkbox</label></td>
</tr>

with CSS:

#text:hover #cb1:hover
{
/* I mean: if #text is hovered, then #cb1 is hovered too. But it doesn't work */
}

Can you help me?




The multiple select checkboxes of Custom UITableviewcell is not selecting

I use below code for sending my uitableview cell to editing mode:

- (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 3;
}

when I enable editing mode the checkboxes of editing mode appears in my cells but when I click on the cells only the background changes, the checkbox not selecting or deselecting.

Please see below image: enter image description here

Does anyone have any idea about what is wrong??

I set the selectionStyle of the cells like below:

    [cell setSelectionStyle:UITableViewCellSelectionStyleGray];

now, checkboxes is checking but when the cell is more higher, a line is adding to center of cell too!!

enter image description here




How to create a template for checkbox groups to avoid code duplication at server side?

I have found a question recently (http://ift.tt/1HDLKzE). Now, I would like to create a template for the HTML generation, as it seems a good idea to avoid code duplication. This is how my html is generated:

// ---------------------------------------
// --- Populate "Body Type" dropdown list:
// ---------------------------------------

// for populate body types:
$bodytype = array(); 

// Select exsiting body type from database:  
$prep_stmt = " SELECT id,   name FROM body_type";

$stmt = $mysqli->prepare($prep_stmt);

if ($stmt) {
    // Bind "$userId" to parameter.
    //$stmt->bind_param('i', $userId);  
    // Execute the prepared query.
    $stmt->execute();    
    $stmt->store_result();

    // get variables from result.
    $stmt->bind_result($id, $name);

    // Fetch all the records:
    while ($stmt->fetch()) {

        // XSS protection as we might print these values
        $name = preg_replace("/[^a-zA-Z0-9_\-]+/", "", $name);
        $id   = filter_var($id,FILTER_SANITIZE_NUMBER_INT);

        $type  = "<label class='checkbox-inline'>\n";
        if ($name == 'Any'){
            $type .=    "<input type='checkbox' id='bodyTypeAny' name='bodyTypeCheck[]' value='{$id}'> {$name}\n";
        } else {
            $type .=    "<input type='checkbox' id='' name='bodyTypeCheck[]' value='{$id}'> {$name}\n";
        }
        $type .= "</label>\n";  
        //Add body types to array
        $bodytype[] = $type;    
    }   
} else {
    echo 'Database error';
}   

// Close the statement:
$stmt->close();
unset($stmt);

All PHP Code for checkbox groups : http://ift.tt/1d7t7ft

How can I implement a function which would generate a checkbox group, so I would simply call it as a function.

Hope somebody may help me out. Thank you.




Place (locate) a CheckBox on the Form programmatically

I'm trying to create a MessageBox with an input field and a checkbox. Could you please help me to locate the CheckBox correctly? Here's my code:

public static DialogResult InputBox(string title, string promptText, ref string value, out bool isChecked)
{
    var form = new Form();
    var label = new Label();
    var textBox = new TextBox();
    var btnOk = new Button();
    var btnCancel = new Button();
    var checkBox = new CheckBox();

    form.Text = title;
    label.Text = promptText;
    textBox.Text = value;
    checkBox.Checked = false;

    checkBox.Text = @"Tick this:";
    btnOk.Text = @"Save";
    btnCancel.Text = @"Cancel";
    btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
    btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;

    label.SetBounds(9, 20, 372, 13);
    textBox.SetBounds(12, 36, 372, 20);
    checkBox.SetBounds(12, 42, 372, 13);
    btnOk.SetBounds(228,72,75,23);
    btnCancel.SetBounds(309, 72, 75, 23);

    label.AutoSize = true;
    checkBox.Anchor = checkBox.Anchor | AnchorStyles.Right;
    textBox.Anchor = textBox.Anchor | AnchorStyles.Right;
    btnOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
    btnCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;

    //form.ClientSize = new Size(396, 107);
    form.ClientSize = new Size(396, 127);
    form.Controls.AddRange(new Control[] {label, textBox, checkBox, btnOk, btnCancel});
    form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height);
    form.FormBorderStyle = FormBorderStyle.FixedDialog;
    form.StartPosition = FormStartPosition.CenterScreen;
    form.MinimizeBox = false;
    form.MaximizeBox = false;
    form.AcceptButton = btnOk;
    form.CancelButton = btnCancel;

    var dialogResult = form.ShowDialog();
    value = textBox.Text;
    isChecked = checkBox.Checked;
    return dialogResult;
}

And here's how I call the method:

        if (InputBox("Save", "Name: ", ref value, out isChecked) != DialogResult.OK)
            return;

The thing is that without the CheckBox everything works fine, but when I try to add the CheckBox, I can't locate it normally (I need it just below the input field). So could you help me with placing this checkbox correctly?




Adding checkBoxes to UniformGrid

I am adding dynamically created checkboxes to an uniformgrid in wpf. But it looks like the gird doesnt allocate them enough space and so they all kinda lay over each other. This is how I add them in code behind:

foreach (string folder in subfolders)
{
  PathCheckBox chk = new PathCheckBox();
  chk.Content = new DirectoryInfo(folder).Name;
  chk.FullPath = folder;
  chk.HorizontalAlignment = System.Windows.HorizontalAlignment.Stretch;
  chk.VerticalAlignment = System.Windows.VerticalAlignment.Stretch;        

  unfiformGridSubfolders.Children.Add(chk);
}

This is how my XAML looks (I placed the uniformgrid in a scrollviewer)

<ScrollViewer Grid.Column="1" Grid.RowSpan="3">
  <UniformGrid x:Name="unfiformGridSubfolders" Grid.Column="1" Grid.Row="0" Grid.RowSpan="3" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"/>
</ScrollViewer>  

And this is how it looks in the program:

enter image description here

I just want that every checkBox has enough space, so that the content can be fully read.




How to uncheck all checkboxes, if one checkbox checked?

I have a set of checkboxes, something like this:

<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="" value="4"> any
</label>

Using these checkboxes, users can make make selection. But if an user select "any" checkbox then I need to deselect all other selection.

I tried it something like this, but it doesn't work for me.

$('.checkbox-inline').click(function(){
      $("input[type='checkbox']").attr('checked', false);
      $(this).attr('checked', true);
})

Can anybody tell me how can I do this in jquery?

NOTE: I am using dynamically generated HTML for my checkboxes.




How to set checkbox value in a BaseAdapter class in Android

I have listview in that i am inflating a Layout that will have checkbox like this

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <CheckBox
        android:id="@+id/checkBox"
        android:text=""
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
</LinearLayout>

Now from the main Activity i am calling a Adapter class

 public  void setData(){
        dataList = new ArrayList<String>();
        Adapterclass = new MAdapter(this);
        for (int i = 0; i < data.length; i++) {
            Adapterclass .addItem(str[i]);
            dataList .add(str[i]);
        }
        listview.setAdapter(Adapterclass);
    }

Base Adapter Class

 public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        CheckBox cb;
        if (convertView == null) {
            holder = new ViewHolder();
            convertView = mInflater.inflate(R.layout.main, parent, false);
            cb = (CheckBox) convertView.findViewById(R.id.checkbox);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        String str = mData.get(position);
       return convertView;
    }

I want to set the value of the checkbox i.e cb in the adapter class how can we do this .Please help me in this




please help me, how to checked looping cekbox with array (php)

someone please help me,,, I have products in my database like this :

  1 -> torch
  2 -> speaker
  3 -> laptop
  4 -> handphone
  5 -> mouse
  6 -> lcd 

and in edit form, id product (example : 1,3,4,5 ) have been selected, but my form didn't selected the checkbox properly. here is my code :

$selected=array(1,3,4,5);
        
        foreach ($selected as $val)

        $q=mysql_query("Select * from product");
        while ($r=mysql_fetch_array($q)){
                
                echo "<input type='checkbox' name='product[]'"; if($r['id']== $val ){ echo"checked"; } echo"> $r[product]<br>";
                
                }

the result is only id no 5 is selected, it should be 4 products selected,,,




samedi 30 mai 2015

Coffeescript evaluates only once

I want to make a select all checkbox based on this findle. I made a coffeescript like this:

$(document).on 'click','.select_all_clans', ->
  if $(this).is(':checked')
    $('.clan_checkbox').attr 'checked', true

But it works only when the check_box.clan_checkbox was not selected earlier, and it checks them only once.

This is my form:

<%= form_tag show_schools_path do %>
 <p>
   Wybierz klan/y: 
   Feniks: <%= check_box_tag 'clans[]','Feniks', (true if !@clans.nil? and @clans.include? 'Feniks'), class: "clan_checkbox" %>,
   Jednorożec: <%= check_box_tag 'clans[]','Jednorożec', (true if !@clans.nil? and @clans.include? 'Jednorożec'), class: "clan_checkbox" %>,
   Krab: <%= check_box_tag 'clans[]', 'Krab', (true if !@clans.nil? and @clans.include? 'Krab'), class: "clan_checkbox" %>,
   Lew: <%= check_box_tag 'clans[]', 'Lew', (true if !@clans.nil? and @clans.include? 'Lew'), class: "clan_checkbox" %>,
   Zaznacz Wszystkie: <%= check_box_tag 'select_all', 'nil', false, class: "select_all_clans" %>
 </p>
<%= submit_tag "Szukaj!" %>
<% end %>

I think this is becouse of this (true if !@clans.nil? and @clans.include? 'Lew')evaluation.

I am just starting learning CS so pleasemake full explain if possible :)




rails check_box_tag disapear

I want to make a form based on check_boxes, and I want it to be checked, if '@clans' array is not nil and it contains a 'value' of a given checkbox.

My first atemnpt was:

<%= check_box_tag 'clans[]','Feniks', true if !@clans.nil? and @clans.include? 'Feniks' %>

but when @clans is nil, the check_box disappears, just like it was disabled.

I managed to solve it with code like that:

  <% if !@clans.nil? and @clans.include? 'Feniks' %>
    Feniks: <%= check_box_tag 'clans[]','Feniks', true %>
  <% else %>
    Feniks: <%= check_box_tag 'clans[]','Feniks' %>
  <% end %>

but it looks so bad, that there have to be a better way to write this :)

Please show me how to handle this :)




Play Framework Checkbox and duplicated Entry

I have in my Scala View a for loop that displays an all saved records of an Entity as checkboxes inputs, so I have N numbers of checkboxes. The idea is to map that Entities with another with ManyToMany annotation.

I could display the checkboxes and can persist the data. The issue is that any checkbox that i check is save as a new entity and not mapped with the current saved record that exist.

I really do not know how to change this, every time that I check on checkbox I have a new Entity and my father Entity (what has the ManyToMany annotation) is mapped with the a new persist entry.

Can you help me please?

Thanks & Regards,




Javascript Checkbox Validation not Checking if Ticked

I've looked through a lot of the questions that people have already asked on this, but I cannot find a solution that has helped me.

I'm a beginner to programming so know little about what to do, I have four check boxes and to submit the form, you have to select at least one of them, but no message comes up and the form is able to be submitted without one of the boxes being ticked.

This is my code below:

        <tr>
       <td align="right">
        <label for="erdbeersocken"><p>Erdbeersocken<sup>*</sup>:</label>
        <br>
        <label for="armstulpen">Armstulpen<sup>*</sup>:</label>
        <br>
        <label for="cupcakes">Cupcakes<sup>*</sup>:</label>
        <br>
        <label for="babykleidung">Babykleidung<sup>*</sup>:</label>
        <br>
       </td>       
       <td align="left">
<form action="../" onsubmit="return checkCheckBoxes(this);">
    <input type="CHECKBOX" name="CHECKBOX_1" value="Erdbeersocken">
    <br>
    <input type="CHECKBOX" name="CHECKBOX_2" value="Armstulpen">
    <br>
    <input type="CHECKBOX" name="CHECKBOX_3" value="Cupcakes">
    <br>
    <input type="CHECKBOX" name="CHECKBOX_4" value="Babykleidung">
    <br>
    <input type="SUBMIT" value="Submit!">
    </td>
</tr>   
</form>

<script type="text/javascript" language="JavaScript">
<!--
function checkCheckBoxes(theForm) {
    if (
    theForm.CHECKBOX_1.checked == false or
    theForm.CHECKBOX_2.checked == false or
    theForm.CHECKBOX_3.checked == false or
    theForm.CHECKBOX_4.checked == false)
    {
        alert ('You didn\'t choose any of the checkboxes!');
        return false;
    } else {    
        return true;
    }
}
//-->
</script>

Which looks like: Text here (Checkbox here)

I'm using Notepadd++ more advanced code does not seem to work, so if anyone could help me with simplified JavaScript, I would really appreciate it. :)




rails simple_form boolean with text label correctly implemented?

Trying to make a boolean with a label left but it fails, I could not find any complete example in the documentation online.

Currently Im using:

  = f.input_field :remember_me, as: :boolean,
                  :input_html => { :checked => true },
                  :inline_label => true

  = f.label "Remember me"
  %br

enter image description here




Multiple, but limited, CheckBoxes in FXML/JavaFX

I'm trying to find a way to use check boxes to allow the user to pick two things from a list of three, and then have the remaining check box become disabled until one of the others is un-selected. I have a ChangeListener attached to all three check boxes, so I can register when two have been selected, but I don't know how to target the "other" box/boxes to disable/enable them.

ChangeListener checkboxlistener = new ChangeListener() {
int i = 0;
        @Override
        public void changed(ObservableValue observable, Object oldValue, Object newValue) {


            if((boolean) observable.getValue() == true) {

                i++;
                System.out.println(i);
            } else {
                i--;
                System.out.println(i);
            }
            if(i == 2) {
                //What should I put here, if anything?//
            }
        }

};
    checkbox1.selectedProperty().addListener(checkboxlistener);
    checkbox2.selectedProperty().addListener(checkboxlistener);
    checkbox3.selectedProperty().addListener(checkboxlistener);

}




vendredi 29 mai 2015

How to create Recycler View with checkboxes

I want to create a RecyclerView with a list of options with check boxes. There must be buttons Select All and Deselect All to select and deselect all check boxes in the RecyclerView. Individual check box selection also need to be there.

enter image description here

Can any one help me ???

Thanks in advance




How to store checkbox value with shared preference?

In my app I am trying to store checkbox value in shared preference,when user click on btn checkbox value should store in shared preference..But whenever again i open my app checkbox status got null,following is my snippet code,what is the issue with this code..

 public class ConfigurationsActivity extends Activity {

ImageView img_navigation_link;
private Button btn_set_configs;
String who;
private EditText edt_api_url, edt_username, edt_password;
private CheckBox edt_Autenticate;
private Button btn_Save_settings;
private TextView txtuname;
private TextView txtpname;
private TextView txtauth;
int aj;

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_configuaration);


    edt_api_url = (EditText) findViewById(R.id.edt_api_url);

    initialize();
    onclickWidgets();


    if(consts.pref.getBoolean("checkbox", false))
    {
        edt_Autenticate.setChecked(true);

    }
    else
    {
        edt_Autenticate.setChecked(false);

    }

    edt_Autenticate.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // TODO Auto-generated method stub
            if (isChecked) {

                aj=1;
                System.out.println("when aj 1"+aj);
                //consts.pref = getSharedPreferences("pref", MODE_PRIVATE);
                consts.pref.edit().putBoolean("check", true).commit();

            }
            else
            {
                aj=2;
                System.out.println("when aj 2"+aj);

            }

        }
    });


    // imgone=(RelativeLayout)findViewById();
}

private void initialize() {

    consts.pref = getSharedPreferences("pref", MODE_PRIVATE);
    consts.editor = consts.pref.edit();
    who = consts.pref.getString("who", "");
    consts.Base_URL = consts.pref.getString(consts.Base_URL, consts.Base_URL);
    edt_api_url.setText(consts.Base_URL);


    TextView current_office_name = (TextView) findViewById(R.id.txt_configuration);
    current_office_name.setText(consts.pref.getString("office_name", ""));
    //
    Log.d("api url configurations", consts.pref.getString(consts.Base_URL, consts.Base_URL));

    txtuname = (TextView) findViewById(R.id.txt_username);
    txtpname = (TextView) findViewById(R.id.txt_password);
    txtauth = (TextView) findViewById(R.id.txt_Autenticate);

    edt_username = (EditText) findViewById(R.id.edt_username);
    edt_password = (EditText) findViewById(R.id.edt_password);
    edt_Autenticate = (CheckBox) findViewById(R.id.edt_Autenticate);
    btn_Save_settings = (Button) findViewById(R.id.btn_Save_settings);

//  System.out.println(" check nu status "+consts.pref.getBoolean("checkbox", false));



    if (who.equals("config")) {
        edt_username.setVisibility(View.GONE);
        edt_password.setVisibility(View.GONE);
        edt_Autenticate.setVisibility(View.GONE);
        txtpname.setVisibility(View.GONE);
        txtuname.setVisibility(View.GONE);
        txtauth.setVisibility(View.GONE);

    } else if (who.equals("user")) {

        edt_api_url.setKeyListener(null);


    }
    img_navigation_link = (ImageView) findViewById(R.id.img_navigation_link);
    img_navigation_link.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub

            Intent intent = new Intent(ConfigurationsActivity.this, MainMenu.class);
            startActivity(intent);
            ConfigurationsActivity.this.finish();
        }
    });

    btn_Save_settings.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method s
            if (who.equals("config")) {

                if (edt_api_url.getText().toString().trim().equals("")) {

                    Toast.makeText(getApplicationContext(), "Endereço API inválido", Toast.LENGTH_SHORT).show();

                } else {

                    {
                        consts.editor.putString(consts.Base_URL, edt_api_url.getText().toString().trim());
                        consts.editor.commit();

                        Toast.makeText(getApplicationContext(), "As configurações foram guardadas",
                                Toast.LENGTH_SHORT).show();
                    }
                }

            } else if (who.equals("user")) {
                if (edt_username.getText().toString().trim().equals("")
                        && edt_password.getText().toString().trim().equals("")) {
                    Toast.makeText(getApplicationContext(), "Digite nome de usuário e senha", Toast.LENGTH_SHORT)
                            .show();
                } else {

                    if (edt_username.getText().toString().trim().equals(consts.pref.getString("user_name", ""))
                            && edt_password.getText().toString().trim()
                                    .equals(consts.pref.getString("user_password", ""))) {


                        if(aj==1)
                        {
                            consts.editor.putBoolean("checkbox", true).commit();
                            consts.editor.commit();
                        }
                        else
                        {
                            consts.editor.putBoolean("checkbox", false).commit();
                            consts.editor.commit();
                        }


                        Toast.makeText(getApplicationContext(), "As configurações foram guardadas",
                                Toast.LENGTH_SHORT).show();


                    } else {
                        Toast.makeText(getApplicationContext(), "Nome de usuário e senha errada",
                                Toast.LENGTH_SHORT).show();
                    }

                }
            }
        }
    });

}

private void onclickWidgets() {
}




Kendo Grid: Column Header Checkbox 'Check All' that checks boxes across grid all pages

Is there an example out there in javascript and/or jquery where someone has a 'Check all' checkbox that checks all checkboxes across all pages of a grid?

I have been trying for 3 days now and I am not finding a clean answer.

What i have now is ugly and does not really work...

        function onRequestEnd(e) {
            var masterCbChecked = $("#masterCheckBox").is(':checked');
            var grid = $("#grid").data("kendoGrid");

            for (var i = 0; i < grid.dataSource.total(); i ++) {
                var dataRow = $("#grid").data("kendoGrid").dataSource.data()[i];
                var elementRow = grid.table.find(".cbAdvisor")[i];
                if (elementRow != null) {
                    var checked = elementRow.checked,
                        row = $(elementRow).closest("tr"),
                        dataItem = grid.dataItem(grid.tbody.find("tr").eq(i));
                    checkedIds[dataItem.DimAgentId] = masterCbChecked;
                    if (masterCbChecked) {
                        //-select the row
                        elementRow.checked = true;
                        row.addClass("k-state-selected");
                        dataRow.IsSelected = true;
                    } else {
                        //-remove selection
                        elementRow.checked = false;
                        row.removeClass("k-state-selected");
                        dataRow.IsSelected = false;
                    }
                }
            }

        }

        function checkAll(ele) {
            var state = $(ele).is(':checked');
            var grid = $("#grid").data("kendoGrid");
            //grid.dataSource.pageSize(grid.dataSource.total());
            //grid.dataSource.read();
            //grid.refresh();

            var currentPage = $("#grid").data("kendoGrid").dataSource.page();

            checkedIds = {};

            //for (var a = 0; a < modelJson.length; a ++) {
            //    var m = modelJson[a];
            //    m.IsSelected = true;
            //}
            for (var a = 1; a < 2; a ++) {
                var pager = grid.pager;
                pager.bind('change', a);
                grid.one("dataBound", function () {
                    this.dataSource.page(a);
                });
                grid.dataSource.fetch();

                for (var i = 0; i < grid.dataSource.total(); i ++) {
                    var dataRow = $("#grid").data("kendoGrid").dataSource.data()[i];
                    var elementRow = grid.table.find(".cbAdvisor")[i];
                    if (elementRow != null) {
                        var checked = elementRow.checked,
                            row = $(elementRow).closest("tr"),
                            dataItem = grid.dataItem(grid.tbody.find("tr").eq(i));
                        checkedIds[dataItem.DimAgentId] = state;
                        if (state) {
                            //-select the row
                            elementRow.checked = true;
                            row.addClass("k-state-selected");
                            dataRow.IsSelected = true;
                        } else {
                            //-remove selection
                            elementRow.checked = false;
                            row.removeClass("k-state-selected");
                            dataRow.IsSelected = false;
                        }
                    }
                }

                pager.bind('change', currentPage);
                grid.one("dataBound", function () {
                    this.dataSource.page(currentPage);
                });
                grid.dataSource.fetch();

                //mark for paging
                if (dataRow != null) {
                    if (state) {
                        dataRow.IsSelected = true;
                    } else {
                        dataRow.IsSelected = false;
                    }
                }

            };

            if (!state) {
                checkedIds = {};
            }

            //grid.dataSource.pageSize(50);
            //grid.refresh();
        }




validate selected checkboxes in listview wicket

How can I validate that not more than one checkbox is selected in a listview (repeater)?

I have a Form with a ListView in Wicket with following structure:

line 1 to n: AjaxCheckBox and TextField

Both elements are connected by CompoundPropertyModel<SimpleType>. POJO SimpleType looks like:

public class SimpleType {
   private boolean selected;
   private String value;

   Getter/Setter...
}

If more than one checkbox is selected, form should reject any changes. So the user must deselect the selected checkbox first before he can choose another checkbox. I tried with surrounded CheckGroup with IValidator<Collection<SimpleType>>, but I need to change AjaxCheckBox to component Check. In this case Check seems to be not updated with state selected from CompoundPropertyModel.

Do I really need a Validator or Visitor for this case? How to implement them?




Appcompat v7 Material checkbox changing color to default black in Lollipop devices

I am using appcompat v7 material checkbox. My project theme is light blue, so I am assigning light blue for my checkbox checked color in styles.xml as follows

<!--checked color-->
<item name="colorAccent">@color/light_blue</item> 

<!--un checked color--> 
<item name="android:textColorSecondary">@color/secondary_text</item>  

In My layout file

    <CheckBox
        android:id="@+id/chk_tick"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:button="@drawable/abc_btn_check_material"
        android:layout_gravity="center"/>

Everything works fine with the versions below kitkat's, but the problem arises only with lollipop versions ( By default it is automatically assigning black color ). I really dont know why it is happening. Kindly please help me with your solutions. Thanks in advance




Using Check boxes to update input text field

I'm learning how to do different things with JavaScript and HTML for webpage design and I ran into a problem I can't figure out and can't seem to find when I look for a solution.

I'm making a simple check box table where you are asked a question, you select an answer and a response gets updated based on your answer. The user can click the boxes and the response will always be updated. I only have one funtion in my JS right now because I was trying to get it to work first before writing the other two. Here is what I have.

function StrengthCheckbox() {
  var strengthCheckYes = document.getElementById("strengthCheckYes");
  var strengthCheckNo = document.getElementById("strengthCheckNo");

  if (strengthCheckYes === document.getElementById("strengthCheckYes").checked) {
    document.getElementById("checkboxStrengthResponse").value = "You wrestled Putin in your past life didn't you?";
  } else if (strengthCheckNo === document.getElementById("strengthCheckNo").checked) {
    document.getElementById("checkboxStrengthResponse").value = "That could be a problem sometime in the future";
  } else if ((strengthCheckYes === document.getElementById("strengthCheckYes").checked) && (strengthCheckNo === document.getElementById("strengthCheckNo").checked)) {
    document.getElementById("checkboxStrengthResponse").value = "So which is it? Yes or No? Stop playing around!";
  }
};
<thead>
  <th colspan="3">Checkbox Version</th>
</thead>
<tbody>
  <tr>
    <td>
      <p>Question</p>
    </td>
    <td>
      <p>Answer</p>
    </td>
    <td>
      <p>My Response</p>
    </td>
  </tr>
  <tr>
    <td>
      <p>Can you fight with your bare hands?</p>
    </td>
    <td>
      <input type="checkbox" id="strengthCheckYes" onchange="StrengthCheckbox()">YES</input>
      <input type="checkbox" id="strengthCheckNo" onchange="StrengthCheckbox()">NO</input>
    </td>
    <td>
      <input type="text" id="checkboxStrengthResponse" size="60px" disabled></input>
    </td>
  </tr>
  <tr>
    <td>
      <p>Are you able to outrun a flying car?</p>
    </td>
    <td>
      <input type="checkbox" id="speedCheckYes" onchange="SpeedCheckbox()">YES</input>
      <input type="checkbox" id="speedCheckNo" onchange="SpeedCheckbox()">NO</input>
    </td>
    <td>
      <input type="text" id="checkboxSpeedResponse" size="60px" disabled></input>
    </td>
  </tr>
  <tr>
    <td>
      <p>Can you out play a super AI in chess?</p>
    </td>
    <td>
      <input type="checkbox" id="intelligenceCheckYes" onchange="IntelligenceCheckbox()">YES</input>
      <input type="checkbox" id="intelligenceCheckNo" onchange="IntelligenceCheckbox()">NO</input>
    </td>
    <td>
      <input type="text" id="checkboxIntelligenceResponse" size="60px" disabled></input>
    </td>
  </tr>
</tbody>
</table>

Any help is welcome. Also, I don't know JQuery and I'm sure it can be done using that but I would like only JS answers if you could. Thank you again




Angular.js: How can I switch between radio and checkbox based on what button is selected?

I'm trying to select one or many of the 4 answers to a quiz based on which button ("Single Answer"/"Multiple Answers") is selected. The issue is that the checkbox is also behaving like radio (though its looking like a checkbox). I think its because I have the "value" attribute which makes it behave like a radio (only 1 item selected at a time).

<li class="list-group-item properties-sidebar">
                <p>Correct Answer Type</p>
                <div class="btn-group btn-group-justified" role="group" aria-label="Single, Multiple, or True/False?">
                  <div class="btn-group" role="group">
                    <button type="button" ng-class="{'btn btn-default': true, 'active': currentAnswerType === 'radio'}" ng-click="selectAnswerType(0)">Single</button>
                  </div>
                  <div class="btn-group" role="group">
                    <button type="button" ng-class="{'btn btn-default': true, 'active': currentAnswerType === 'checkbox'}" ng-click="selectAnswerType(1)">Multiple</button>
                  </div>
                  <div class="btn-group" role="group">
                    <button type="button" class="btn btn-default" ng-click="selectAnswerType(2)">True/False</button>
                  </div>
                </div>
              </li>
              <li class="list-group-item properties-sidebar">
                <p>Answer 1</p>
                <div class="input-group"><span class="input-group-addon"><input type="{{currentAnswerType}}" ng-model="currentQuestion.correctAnswer" value="0" aria-label="..."></span>
                  <input type="text" class="form-control" placeholder="Enter Answer 1 here ..." aria-describedby="sizing-addon3" ng-model="currentQuestion.answers[0]">
                </div>
              </li>
              <li class="list-group-item properties-sidebar">
                <p>Answer 2</p>
                <div class="input-group"><span class="input-group-addon"><input type="{{currentAnswerType}}" ng-model="currentQuestion.correctAnswer" value="1" aria-label="..."></span>
                  <input type="text" class="form-control" placeholder="Enter Answer 2 here ..." aria-describedby="sizing-addon3" ng-model="currentQuestion.answers[1]">
                </div>
              </li>
              <li class="list-group-item properties-sidebar">
                <p>Answer 3</p>
                <div class="input-group"><span class="input-group-addon"><input type="{{currentAnswerType}}" ng-model="currentQuestion.correctAnswer" value="2" aria-label="..."></span>
                  <input type="text" class="form-control" placeholder="Enter Answer 3 here ..." aria-describedby="sizing-addon3" ng-model="currentQuestion.answers[2]">
                </div>
              </li>
              <li class="list-group-item properties-sidebar">
                <p>Answer 4</p>
                <div class="input-group"><span class="input-group-addon"><input type="{{currentAnswerType}}" ng-model="currentQuestion.correctAnswer" value="3" aria-label="..."></span>
                  <input type="text" class="form-control" placeholder="Enter Answer 4 here ..." aria-describedby="sizing-addon3" ng-model="currentQuestion.answers[3]">
                </div>
              </li>

How can I get either radio or checkbox behavior based on whether the answer type is "radio" or "checkbox" (selected by pressing the appropriate button in the button group)




Jquery Compare original state of checkbox with change state

what i want to do is that, i want to hold the value of the checkbox(original state) and then on checkbox state change check if the state is not original state then show a textarea.

what i have done till now

<script>
    var status = $('#status').val();
    $(document).ready(function() {
        status = $('#status').is(":checked");
        $('#status').on('click', function() {
           if( $('#status').is(":checked")!=status){
               $('#mandatory').html('*');
           }else{
               alert("else");
               $('#mandatory').html('');
           }
        });
    });
</script>

problem i am facing is that it is not comparing two values.




How to refresh backend page without closing popup on ajax call

I want to implement feature like jabong (click here) and click on 87 More somthing on left pannel, You can find popup with check box, If you click any checkbox it's backend whole page get refersh with filter item.

I want to implement same functionality with Hybris. If I am using AJAX then how to refresh whole back page with return result html ?




check all jquery not working for dynamically populated checkbox

I have a jquery function to select all checkboxes , which are populated in PHP loop. The output of the loop is similar to below:

<label class="check"><input type="checkbox" name="selectall" value="All"/> Select All</label>
<label class="col-md-3 col-xs-12 control-label">Types Of function</label>
<div class="col-md-6 col-xs-12">                                                                                            
    <div class="col-md-7">                                    
        <label class="check"><input type="checkbox"  name="chkUser" class="icheckbox"/> Birthday</label>
    </div>
    <div class="col-md-7">                                    
        <label class="check"><input type="checkbox"  name="chkUser" class="icheckbox"/> Family Function</label>                   
    </div>
    <div class="col-md-7">                                    
        <label class="check"><input type="checkbox"  name="chkUser" class="icheckbox"/> conference</label>                        
    </div>
    <div class="col-md-7">                                    
        <label class="check"><input type="checkbox"  name="chkUser" class="icheckbox"/> wedding</label>                           
    </div>
    <div class="col-md-7">                                    
        <label class="check"><input type="checkbox"  name="chkUser" class="icheckbox"/> Corporate</label>                             
    </div>
</div>

And the jquery function is :

$('.selectall').click(function() { //alert('HHH');
    if ($(this).is(':checked')) {
        $('.icheckbox').attr('checked', 'checked');
    } else {
        $('.icheckbox').attr('checked', false);
    }
});

But unfortunately its not working ! What's wrong ?

Jsfiddle Here




Display of checkboxes in dataTable in Shiny not displaying, html code displays, how to fix that?

I am displaying a dataTable in Shiny, and I added the checkboxes to one of my dataTables, however it doesn't display the checkboxes but shows the code the html code for the checkbox " " Does anyone know the fix for this? Thank you!

Here is a summary of code I used:

Ui file: DT::dataTableOutput(paste0("siFactors_",i))

Server file: output[[paste0('siFactors_', i)]] <- DT::renderDataTable({ datatable(final_array, extensions='KeyTable', rownames = checkboxRows(final_array, checked = box_indices), options = list(deferRender = TRUE, paging = FALSE, searching = FALSE, autoWidth = FALSE, scrollX = TRUE, scrollY = 600, scrollCollapse = TRUE

                            )



              )


  })




limited CheckBox in gridview

Please help me to check the coding, how to set 5 limited for checkbox selection in grid view, I am using SparseBooleanArray.....

        holder.cb.setTag(position);
        holder.cb.setContentDescription(Uri.withAppendedPath(
              MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "" + imageID).toString());
        holder.cb.setChecked(mSparseBooleanArray.get(position));
        holder.cb.setOnCheckedChangeListener(new OnCheckedChangeListener() {

            @Override
            public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
                // TODO Auto-generated method stub
                mSparseBooleanArray.put((Integer) buttonView.getTag(),  isChecked);


            }
        });




how to dynamically enabled and disabled button when checkbox is checked and unchecked in semantic UI

how to dynamically enabled and disabled button when checkbox is checked and unchecked in semantic UI, ive spend so many times to do this small creepy codes

here is the html

<div class="ui fitted checkbox">
<input type="checkbox" > <label></label>
</div>
<div class="ui small positive disabled button" id="edit">
<i class="edit icon"></i> Edit
</div>

here is my javascript

<script>
    $(document).ready(function () {
                    if (
                    $('#cek').checkbox({
                        onChecked: function () {
                        }
                    })) {
                        $('#edit').removeClass('disabled');
                    } else {
                        $('#edit').addClass('disabled');       
                    }
                });
</script>

please help,thats make me crazy




HTML Elements display:initial or display:none changing upon checkbox state

I have created a little set-up with

and elements, which I want to either be shown or hidden depending on the state of their designated checkbox. When the checkbox is checked, display:intial should be set, when the checkbox is unchecked, display:none should be set. However, I've been trying to find out how to do this with JS, but I haven't gotten anywhere. An example of the code I have:

    <p id="nr_1" style="display:initial"> Number 1 Example text here </p>
    <input type="checkbox" id="nr_1" checked > Number 1</input> 
    <p style="display:initial" id="nr_1"> <img src="src_nr_1.png"> </p>

The JS I've managed to scramble together from what I could find look like this:

    function handleClick($id) {
    if (document.getElementById($id).display == checked) {
    var element = document.getElementById($id);
    element.style = "display:initial";
    else {
    var element = document.getElementById($id);
    element.style = "display:initial"; }

However, I haven't even been able to succesfully have the checkbox do ANYTHING. I've tried it with If/Else simply popping up an alert with texts to see if I had been able to have anything happen upon checking and unchecking the checkbox. It's probably very obvious from the constructions I've been building, but I've never used JS before. I imagine it has to do something with onClick() or onCheck(), but neither have seemed to respond to anything at all.

So what I'm trying to do here is have the JS react upon checking/unchecking a checkbox. I'd like to keep it as general as possible, because there's going to be somwhere between 10-25 checkboxes, and having to hardcode it for every different HTML element wouldn't be the most ideal situation. The checkbox, Text element and Image all have the same ID to match them with. So if Checkbox 1 gets checked, Text element 1 and Image 1 will appear. If it get's unchecked, they both disappear. Anything to point me in the right direction would be greatly appreciated.




jeudi 28 mai 2015

JavaScript "If" Statement Regarding Checkbox Not Working

I have set up an "if" statement in JavaScript that is to check whether or not a checkbox is checked. However, it does not seem to be working. It refers to a checkbox within a form, and the ID for the checkbox is "t1." Please let me know if there is anything apparent that would make it not function properly! It is to be executed when a button on the page is clicked, which should work properly without the "if" statement around it.

The code is below:

var t1v = document.getElementById("t1")

if (t1v.checked) {
    document.getElementById("l1q1").style.display = "inline";
    document.getElementById("1q1-1").style.display = "inline";
    document.getElementById("l1q1-1").style.display = "inline";
    document.getElementById("1q1-2").style.display = "inline";
    document.getElementById("l1q1-2").style.display = "inline";
    document.getElementById("1q1-3").style.display = "inline";
    document.getElementById("l1q1-3").style.display = "inline";
    document.getElementById("1q1-4").style.display = "inline";
    document.getElementById("l1q1-4").style.display = "inline";
}




Can't Check Checkboxes when the Stamper is in append mode

I'm using ItextSharp.text.pdf with Visual Basic 2012. Trying to fill out the f941.pdf from IRS.gov. All was good except it was breaking Usage Rights. So I researched that and created the stamper in append mode. This fixed the usage rights but now I cannot set the checkboxes.

   `MyReader = New PdfReader(myFileName)
    PdfOutputStream = New FileStream(outFileName, FileMode.OpenOrCreate)
    Stamper = New PdfStamper(MyReader, PdfOutputStream, Chr(0), True)
    FormAcroFields = Stamper.AcroFields
    KeysList = FormAcroFields.Fields.Keys.ToList
    SetCheck(Index, True)`

I'm not sure if the Chr(0) is correct in the stamper definition. I get no errors and the result is KeysList(List of String) is filled with the forms field keys. Calling SetCheck(FieldNumber,True) should set the checkbox.

Private Function SetCheck(ByRef Fieldnumber As Integer, Optional State As Boolean = True) As Boolean
    Dim Dstates() As String = FormAcroFields.GetAppearanceStates(KeysList(Fieldnumber))
    If State = True Then
        FormAcroFields.SetField(KeysList(Fieldnumber), Dstates(0))
    Else
        If Dstates.Length > 1 Then
            FormAcroFields.SetField(KeysList(Fieldnumber), Dstates(1))
        Else
            FormAcroFields.SetField(KeysList(Fieldnumber), "")
        End If
    End If
    Return True
End Function

Dstates(0) will hold the value to set the checkbox and if there is a Dstates(1) it would be the off value. If there is only a Dstates(0) then using "" value seems to turn them off. This worked great until I used the append mode.

I found some similar posts but the solutions were in JS and I don't know how to translate that to VB.




Checkboxes won't update in DGV when save is clicked

For some strange reason everytime I try to update/add new row into the Data Grid View the checkboxes don't seem to be affected does anyone know why?

PS. I can edit /add new data with no issues, just the 2 checkbox fields?? I have tried to set them to textbox fields and tried entering "0" or "1" with no luck I have checked to make sure they are not read only. Also in the standard details view(on another form) the checkboxes seem to work fine. Is there something fundamental I'm missing with checkboxes?

    Public Class P3

Private Sub PurchasingBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles PurchasingBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.PurchasingBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.JOBDataSet)

End Sub

Private Sub P3_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'JOBDataSet.Purchasing' table. You can move, or remove it, as needed.
    Me.PurchasingTableAdapter.Fill(Me.JOBDataSet.Purchasing)

End Sub

End Class

TIA




'Find and Save' functionality not working (ASP.net, GridView, DataTable)

First time poster, long time lurker. I am having some trouble with my ASP.NET page, and I hope someone can help me resolve my issue.

Basically, I have a bunch of checkboxes in a gridview, and two buttons: a 'find' button, and a 'save' button. The 'find' can set the value of the checkbox, but if a user unchecks it, I want to capture that change when the user hits 'save'.

The 'find' button does the following:

  1. Builds the DataTable in code and assigns it to the Page's class variable 'infoTable'.
  2. Does a string comparison between a textbox (defined in aspx) and names in a List object
  3. If a name match is found, it uses that to search a list of transactions.
  4. If a transaction match is found, populates (Rows.Add) the infoTable with transaction info (among the data is a bool (isPaid) that started this journey, ill get to that...).
  5. Builds a GridView (also a Page class variable) by using the infoTable as a DataSource, binds it, sets a RowDataBound eventhandler, etc..
  6. The RowDataBound event handler is used to add checkboxes to the last column in the GridView. The status of these checkboxes will be checked or not depending on the status of 'isPaid'.

All of that works. Here is where it gets tricky/confusing:

After I hit the save button, PostBack occurs and both DataTable and GridView empty (Rows.Count is 0 at this point for both). ViewState appears to be lost before I get a chance to loop through the GridView rows to determine the checkbox values.

EnableViewState in the html/.aspx is set to true, but it doesn't appear to help. I've tried building GridView by using (DataTable)ViewState["datatable"] as a datasource. This doesn't help either.

At the end of it all, I just want to capture the status of those checkboxes, changed by user interaction or not, by hitting the 'Save' button.

I found some other articles, but a lot of them haven't worked when I tried implementing the various fixes.

This one seems to be the closest that describes my issue, and the code is structured similarly, but I don't quite understand how to implement the fix: GridView doesn't remember state between postbacks

Any help would be appreciated. Thank you in advance!




Create dynamic new-object checkbox variables from an array, list or hash

I am trying to create check box form/popup that uses a list of PC names that eventually will be passed to the function. Right now I have hard coded the array/list. I want to pop-up a multiple check list that will then based on the input run the script on the PCs that where selected. I'm going to do another test to signify if the PC is online and "pre" check that PC. I'm having issues creating the checkboxes dynamically.

cls

function GenerateForm {

#param (
#   [Object] $PCNames = $null   
#)

$PCNames = @("PC1","PC2","PC3")

[reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null
[reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null

$form1 = New-Object System.Windows.Forms.Form
$button1 = New-Object System.Windows.Forms.Button
$listBox1 = New-Object System.Windows.Forms.ListBox

foreach ($checkBox in $PCNames) {
    $checkBox = New-Object System.Windows.Forms.CheckBox
}
$InitialFormWindowState = New-Object System.Windows.Forms.FormWindowState

$b1= $false
$b2= $false
$b3= $false

#----------------------------------------------
#Generated Event Script Blocks
#----------------------------------------------

$handler_button1_Click= 
{
    $listBox1.Items.Clear();

    foreach ($checkBox in $PCNames) {

    if ($checkBox.Checked)     {  $listBox1.Items.Add( "$checkBox is checked"  ) }

    if ( !$checkBox.Checked) {   $listBox1.Items.Add("No CheckBox selected....")} 

    }
}

$OnLoadForm_StateCorrection=
{#Correct the initial state of the form to prevent the .Net maximized form issue
    $form1.WindowState = $InitialFormWindowState
}

#----------------------------------------------
#region Generated Form Code
$form1.Text = "Primal Form"
$form1.Name = "form1"
$form1.DataBindings.DefaultDataSourceUpdateMode = 0
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 450
$System_Drawing_Size.Height = 236
$form1.ClientSize = $System_Drawing_Size

$button1.TabIndex = 4
$button1.Name = "button1"
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 75
$System_Drawing_Size.Height = 23
$button1.Size = $System_Drawing_Size
$button1.UseVisualStyleBackColor = $True

$button1.Text = "Run Script"

$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 27
$System_Drawing_Point.Y = 156
$button1.Location = $System_Drawing_Point
$button1.DataBindings.DefaultDataSourceUpdateMode = 0
$button1.add_Click($handler_button1_Click)

$form1.Controls.Add($button1)

$listBox1.FormattingEnabled = $True
$System_Drawing_Size = New-Object System.Drawing.Size
$System_Drawing_Size.Width = 301
$System_Drawing_Size.Height = 212
$listBox1.Size = $System_Drawing_Size
$listBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$listBox1.Name = "listBox1"
$System_Drawing_Point = New-Object System.Drawing.Point
$System_Drawing_Point.X = 137
$System_Drawing_Point.Y = 13
$listBox1.Location = $System_Drawing_Point
$listBox1.TabIndex = 3

$form1.Controls.Add($listBox1)


#$checkBox3.UseVisualStyleBackColor = $True
#$System_Drawing_Size = New-Object System.Drawing.Size
#$System_Drawing_Size.Width = 104
#$System_Drawing_Size.Height = 24
#$checkBox3.Size = $System_Drawing_Size
#$checkBox3.TabIndex = 2
#$checkBox3.Text = "CheckBox 3"
#$System_Drawing_Point = New-Object System.Drawing.Point
#$System_Drawing_Point.X = 27
#$System_Drawing_Point.Y = 75
#$checkBox3.Location = $System_Drawing_Point
#$checkBox3.DataBindings.DefaultDataSourceUpdateMode = 0
#$checkBox3.Name = "checkBox3"
#
#$form1.Controls.Add($checkBox3)
#
#
#$checkBox2.UseVisualStyleBackColor = $True
#$System_Drawing_Size = New-Object System.Drawing.Size
#$System_Drawing_Size.Width = 104
#$System_Drawing_Size.Height = 24
#$checkBox2.Size = $System_Drawing_Size
#$checkBox2.TabIndex = 1
#$checkBox2.Text = "CheckBox 2"
#$System_Drawing_Point = New-Object System.Drawing.Point
#$System_Drawing_Point.X = 27
#$System_Drawing_Point.Y = 44
#$checkBox2.Location = $System_Drawing_Point
#$checkBox2.DataBindings.DefaultDataSourceUpdateMode = 0
#$checkBox2.Name = "checkBox2"
#
#$form1.Controls.Add($checkBox2)


foreach ($checkBox in $PCNames) {
    $checkBox.UseVisualStyleBackColor = $True
    $System_Drawing_Size = New-Object System.Drawing.Size
    $System_Drawing_Size.Width = 104
    $System_Drawing_Size.Height = 24
    $checkBox.Size = $System_Drawing_Size
    $checkBox.TabIndex = 0
    $checkBox.Text = "$checkBox"
    $System_Drawing_Point = New-Object System.Drawing.Point
    $System_Drawing_Point.X = 27
    $System_Drawing_Point.Y = 13
    $checkBox.Location = $System_Drawing_Point
    $checkBox.DataBindings.DefaultDataSourceUpdateMode = 0
    $checkBox.Name = "$checkBox"

$form1.Controls.Add($checkBox)
}

#Save the initial state of the form
$InitialFormWindowState = $form1.WindowState
#Init the OnLoad event to correct the initial state of the form
$form1.add_Load($OnLoadForm_StateCorrection)
#Show the Form
$form1.ShowDialog()| Out-Null

} #End Function

GenerateForm

The errors I am getting:

The property 'UseVisualStyleBackColor' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:129 char:5
+     $checkBox.UseVisualStyleBackColor = $True
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Size' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:133 char:5
+     $checkBox.Size = $System_Drawing_Size
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'TabIndex' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:134 char:5
+     $checkBox.TabIndex = 0
+     ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:135 char:5
+     $checkBox.Text = "$checkBox"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Location' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:139 char:5
+     $checkBox.Location = $System_Drawing_Point
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'DefaultDataSourceUpdateMode' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:140 char:5
+     $checkBox.DataBindings.DefaultDataSourceUpdateMode = 0
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'Name' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:141 char:5
+     $checkBox.Name = "$checkBox"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'UseVisualStyleBackColor' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:129 char:5
+     $checkBox.UseVisualStyleBackColor = $True
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Size' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:133 char:5
+     $checkBox.Size = $System_Drawing_Size
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'TabIndex' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:134 char:5
+     $checkBox.TabIndex = 0
+     ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:135 char:5
+     $checkBox.Text = "$checkBox"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Location' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:139 char:5
+     $checkBox.Location = $System_Drawing_Point
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'DefaultDataSourceUpdateMode' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:140 char:5
+     $checkBox.DataBindings.DefaultDataSourceUpdateMode = 0
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'Name' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:141 char:5
+     $checkBox.Name = "$checkBox"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'UseVisualStyleBackColor' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:129 char:5
+     $checkBox.UseVisualStyleBackColor = $True
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Size' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:133 char:5
+     $checkBox.Size = $System_Drawing_Size
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'TabIndex' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:134 char:5
+     $checkBox.TabIndex = 0
+     ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Text' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:135 char:5
+     $checkBox.Text = "$checkBox"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'Location' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:139 char:5
+     $checkBox.Location = $System_Drawing_Point
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException

The property 'DefaultDataSourceUpdateMode' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:140 char:5
+     $checkBox.DataBindings.DefaultDataSourceUpdateMode = 0
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyNotFound

The property 'Name' cannot be found on this object. Verify that the property exists and can be set.
At \\util01\cs\Scripts\PowerShell\BradleyDev\CheckBox.ps1:141 char:5
+     $checkBox.Name = "$checkBox"
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : PropertyAssignmentException




Play Framework Checkbox Form and JPA Mapping

I have an issue related with my ManyToMany relation. The issue happens when I submit the FORM, my controller saves not only on the JOIN table the mapping, also create a new entry for Type class.

My Code:

VIEW:

@main("Create Form"){


    <h1 class="page-header">New Products Form</h1> 
    <div class="row placeholders div-table">
        <div class="col-xs-12 col-sm-12 div-table-row">
            @helper.form(routes.Products.createProducts){
                <div class="form-group">
                @helper.inputText(form("name"), '_label->"Product Name", 'id->"productName", 'name->"productName", 'class ->"form-control", 'placeholder ->"Enter ProductName") 
                </div><!--End First Form Group-->

                <div class="form-group">

                @for(type <- types) {
                <div class="checkbox">
                    <label>
                        <input type="checkbox" name='@(form("types").name)' id="@type" value="@type">
                        @type
                    </label>
                </div>
                }
                </div>
                <button class="btn btn-default">Submit</button>
                } 

Model: Product Model

@Entity
@Table(name = "Products")
public class Product{

    // Class Attributes
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "PRODUCT_ID")
    public Long id;
    public String name;

    @ManyToMany(cascade = CascadeType.ALL, fetch=FetchType.EAGER)

    public List<Type> types;

public Product save() {
        JPA.em().persist(this);
        return this;
    }

} 

Type Model:

@Entity
@Table(name = "Types")
public class Type{

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    @Column(name = "TYPE_ID")
    public Long id;
    public String description;


    public Type(String description) {
        this.description = description;
    }

    public Type(){

    } 
    public Type save() {
        JPA.em().persist(this);
        return this;
    }

Controller:

JPA.withTransaction(new Function0<Rutine>() {
                        @Override
                        public Product apply() throws Throwable {

                            return product.save();
                        }
                    });




HTMLElement.click() on checkbox not working in firefox

use case:- When user clicks on checkbox "A", Checkbox "B" should gets enabled and gets checked automatically.

Issue:- "B" is getting enabled but not getting checked.This issue is happening in firefox, in chrome it's working fine

<!doctype html>
<html>
<title></title>
<head>
<meta http-equiv="Content-Type"
content="text/html;charset=ISO-8859-1">   
<script src="http://ift.tt/AbJPU3"></script> 
<script>
$(document).ready(function(){
      var self = this;
      self.context = $(document.body);
      self.first = $("#123");
      self.second = $("#456");
      self.context.delegate("#123","click",function(e){
         self.context.trigger("first/changed",this);
      });
      self.context.delegate("#456","click",function(e){
           self.context.trigger("second/changed",this);
      });
      self.context.bind("first/changed",function(e,obj){
                self.second.attr({
                   "disabled": ""
                });
                self.second.trigger("click");//**click event is not getting fired**
       });
}); 
</script>     
</head>
<body>
<ul class="main">
<li class="main-list">
    <input type="checkbox" id="123"><span>A</span>
    <ul class="sub">
        <li class="sub-list1">
            <input type="checkbox" id="456" disabled><span>B</span>
        </li>
        <li class="sub-list2">
            <input type="checkbox" id="789" disabled><span>C</span>
        </li>
    </ul>
</li>  
</ul>  
</body>
</html>




ng-model breaks checkbox in Firefox

                    <table st-table="exams" st-safe-src="exams" st-pipe="getExams" class="table table-bordered">

                    <thead st-reset="isReset" st-toggle="toggle">
                        <tr>

                            <th cs-select-all="exams">
                                <input type="checkbox" ng-model="selectedAll" ng-click="checkAllExams()"/>
                            </th>
                            <th st-sort="A" width="25%">A</th>
                            <th st-sort-default="reverse" st-sort="B" width="10%">B</th>
                            <th st-sort="C" width="10%">C</th>
                            <th st-sort="D" width="25%">D</th>
                            <th st-sort="E" width="10%">E</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tbody ng-repeat="exam in exams">
                        <tr>
                            <td cs-select="exam">
                            <input type="checkbox" ng-model="exam.isSelected">
                            </td>
                            <td>{{exam.A}}</td>
                            <td>{{exam.B| date: 'yyyy-MM-dd'}}</td>
                            <td>{{exam.C}}</td>
                            <td>{{exam.D}}</td>
                            <td>{{exam.E}}</td>
                            <td>
                                <a class="btn btn-info" ng-click="Details(exam)"><i
                                        class="glyphicon glyphicon-zoom-in icon-white"></i></a>
                            </td>
                        </tr>
                    </tbody>
                    <tfoot ng-hide="isLoading">
                    <tr>
                        <td colspan="10" class="text-center">
                            <div st-pagination="" st-items-by-page="15"></div>
                        </td>
                    </tr>
                    </tfoot>
                </table>

I have code that resembles something like this. I am using smart-table (http://ift.tt/1aXjM1N) with Angular to display a series of exam info from the database.

The problem lies in the line

<input type="checkbox" ng-model="exam.isSelected">

in Firefox. It works perfectly in chrome but in firefox, I cannot check the checkbox. Interestingly enough, the "select all" checkbox in the table header still works.

What could be the issue?




select/ unselect checkbox angular

I'am facing a issue with Unselecting a checkbox, when the backend service fails. It still remians selected . Here is the flow of code

html -

> <ng-repeat="rx in rxList">
>     <button toggle-switch ng-checked="rx.details.autoFillActive" ng-model="rx.details.autoFillActive" ng-click="toggleReadyFill(rx,
> $event)" ></button>

Js file -

$scope.toggleReadyFill = function(rx, $event) {
           scriptsyncService.addRx(rxList, storeDetails, syncDate).then(
                function(success) {
                    console.log('success');
                },
                function(error) {
                    $scope.selectedRx.isSelected = false;
                });
        };

the issue over here is, when we select the checkbox, we are making service call and if the service fails the checkbox still remains selected. This is being unselected only on refresh of page. How can i unselect the checkbox upon service failure




Accessing a form control inside a group box on the sheet

I have about 100 form control checkboxes on a sheet and have no problem getting to and saving their values. Those are not contained within any group boxes. However, I want to access a specific checkbox that is located inside a group box and that checkbox does not have a meaningful name. I would expect that I could first locate the group, then isolate the checkbox.

How do I loop within a group box, when not on a userform sheet?

I think I have to use .Range(array()) or .Groupitems() but can't seem to make it work.

A way to capture that checkbox (that is located inside a group), while looping through all the checkboxes on mysheet would also be ok since I already do this to save their values.

For Each sh In ws.Shapes If sh.Type = msoFormControl Then If sh.FormControlType = xlGroupBox Then mygroup = sh.name 'need to loop within "mygroup" and find the checkbox Thanks in advance.




save selected checkbox and radio button in notepad

try 
   {
     JFileChooser flcFile = new JFileChooser("c:/");
     int rep = flcFile.showSaveDialog(this);
     File filesave = flcFile.getSelectedFile();
     if (rep == JFileChooser.APPROVE_OPTION)
     {

         try(FileWriter writer = new FileWriter(filesave)) 
         {

             //if(chkE.isSelected() == true){
               //do stuff
              }

              writer.write(String.valueOf(txtNom1.getText()));
              writer.write("\r\n");
              writer.write(String.valueOf(txtPre1.getText()));
              writer.write("\r\n");
              writer.write(String.valueOf(optoui.getText()));
              writer.write("\r\n");
              writer.write(String.valueOf(optoui.getText()));
              writer.write("\r\n");
              writer.write(String.valueOf(optnon.getText()));
              writer.write("\r\n");
              writer.write(String.valueOf(chkanimaux.getText()));
              writer.write("\r\n");
              writer.write(String.valueOf(chkChauffer.getText()));
              writer.write("\r\n");
              writer.write(String.valueOf(chkE.getText()));
              writer.write("\r\n"); 
              writer.write(String.valueOf(txttel.getText()));
              writer.write("\r\n");

             writer.close();
         }
     }

   }



   catch(IOException err1)
   {

   }

my english isn't my first language.

hi, so i need to save information for my final project and i need one little thing for complet it.

my Question is, how i do to save selected checkbox or radio button in notepad?

i know how to save any String information but i dont know how to save the selected checkbox/radio button in my notepad so when i will open it back and it will select it automatically. i tried if(chkE.isSelected() == true) but i dont know what to write in for making it save into my notepad. thx in advance




Jquery checkbox checked when page loads

The script is working fine however I am wondering if there is a way to avoid the repetition in the code (DRY method).

Demo

JS code:

// Checkbox checked and input disbaled when page loads

$('#checkbox').prop('checked', true);

if ($('#checkbox').is(':checked') == true) {
    $('#textInput').prop('disabled', true);
}


// Enable-Disable text input when checkbox is checked or unchecked

$('#checkbox').change(function() {
    if ($('#checkbox').is(':checked') == true) {
        $('#textInput').prop('disabled', true);
    } else {
        $('#textInput').val('').prop('disabled', false);
    }
});




Checkbox to trigger input, and vice versa

I am currently working on a form, and am required to do the following:

If the checkbox next to the input field (in this case, a qty field) is checked, then set the input to "1". If the qty field is greater than one, then the checkbox remains checked.

If the checkbox is unchecked, then the qty field is reset to 0. Alternatively, if the user inputs 0 into the qty field, then the checkbox is also unchecked

Problems

  • The increase button currently requires two clicks to increment the qty
  • When the qty field has a number > 0, and is then decreased to 0, the increase button no longer works.

Can anyone spot the error in my ways?

jQuery('.exhibitorBooking--table .desc input[type="checkbox"]').on('change', function(){
        if(this.checked){
            jQuery(this).parents('tr').find('.qty-field input[type="text"]').val('1');
        } else {
            jQuery(this).parents('tr').find('.qty-field input[type="text"]').val('0');
        }
    });
    jQuery('.exhibitorBooking--table .qty-field input[type="text"]').on('change', function(){
        if(jQuery(this).val() == 0){
            jQuery(this).parents('tr').find('input[type="checkbox"]').attr('checked', false);
        } else if(jQuery(this).val() == 1) {
            jQuery(this).parents('tr').find('input[type="checkbox"]').trigger('change').attr('checked', true);
        } else {
            jQuery(this).parents('tr').find('input[type="checkbox"]').attr('checked', true);
        }
    });

JSFiddle




Can someone help me simplfy my VBA code please

Hi i've got a dashboard that uses a userform box fileld with checkboxes to choose what data to display on a chart. At the minute my code is very copy and pasted. See below:

Private Sub CommandButton21_Click()
UserForm1.Show
If Worksheets("Data Directorate").Range("X4").Value = True Then UserForm1.CheckBox1 = True
If Worksheets("Data Directorate").Range("X5").Value = True Then UserForm1.CheckBox2 = True
If Worksheets("Data Directorate").Range("X6").Value = True Then UserForm1.CheckBox3 = True

Is there a way to use a loop to do this?

I've also got more repeated code later on:

Private Sub CheckBox1_Click()
  Select Case CheckBox1.Value
  Case True
  Worksheets("Data Directorate").Range("X4").Value = True
  Case False
  Worksheets("Data Directorate").Range("X4").Value = False
End Select
End Sub

This repeats for 24 check boxes. Again would it be possible to loop this? Thanks!




jQuery: Check / uncheck all siblings with certain class

I am new to jQuery and hope someone here can help me with this question.

I am trying to set up an "All" checkbox to check / uncheck all its sibling checkboxes (i.e. those under the same div / parent) - but only if they DO NOT have a certain class ("other").

My approach was to cause the least run time and to write this in a way that it can also be applied to similar structures in other divs.

The code I have works without the :not() selector but I can't get it to work when I include this. Also, I am not sure if my approach is the best / fastest way here.

My jQuery:

$('.checkAll').click(function(){
    if($(this).is(':checked')){
        $(this).siblings(":not($('.other'))").prop('checked', true);
    }else{
        $(this).siblings(":not($('.other'))").prop('checked', false);
    }
});

Many thanks in advance for any help, Mike




when check a checkbox, unchecked other with javascript

I fill the table with a ADODB.Recordset. I have 25 rows. But it can change. And last column is checkboxes.

enter image description here

Only one checkbox can select. Check one and uncheck others automatic.

<input class="cb" id="txtdurum_<%=counter%>" name="txtdurum" type="checkbox" />

Help please :)




Android custom checkbox drawable sizes

for my custom checkbox I used simple nine-patch which I created using android studio (from png's which were 512x512px).

Here is the xml for custom checkbox:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://ift.tt/nIICcg">

    <item android:drawable="@drawable/ic_checkbox_unchecked" android:state_checked="false"/>
    <item android:drawable="@drawable/ic_checkbox_checked" android:state_checked="true"/>
    <item android:drawable="@drawable/ic_checkbox_unchecked"/>

</selector>

I've read many threads on this subject, but I found none dealing with size of the chekbox since the size of my new checkbox is big as drawable is. Any attempt to set up fixed size, for example 30x30dp result of drawable being distorted.

So, which size the image drawables should be and if size of the drawables doesn't matter how can I set the size of checkbox to be as the size of standard andorid checkbox?




Disabled Submit button after uncheck from a nested checkbox

i had try to find the solution here with similar question, but none of the solution can fixed my problem. I'm Currently having a problem with disable the submit button whenever i uncheck all checkbox.

Basically my website have few checkbox, when user tick any of the checkbox the disabled submit button will become able to submit. But when user untick the checkbox, my submit button won't disabled back.

Here are my sample HTML Code :

<form action="" id="myform" name="myform" class="myform">
                                            <div class="anchor">
                                                <ul>
                                                    <li>
                                                        <label><input type="checkbox" data-id="All Master" data-name="All Master" id="myCheckBox0" onchange="checkDisabled(testing);"/> All Kedai Kiosk On Master Mode</label>
                                                        <ul>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Selangor" data-name="Selangor"  id="myCheckBox1" onchange="checkDisabled(testing);"/> Selangor</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox"  data-id="Petaling Jaya" data-name="Petaling Jaya" id="myCheckBox2" onchange="checkDisabled(testing);"/> Petaling Jaya&nbsp;&nbsp;</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="1" data-id="Kiosk 1" data-name="Kiosk 1" id="myCheckBox3" onchange="checkDisabled(testing);"/> Kiosk 1&nbsp;&nbsp;</label></li>
                                                                        </ul>                           
                                                                    </li>

                                                                    <li><label><input type="checkbox" data-id="Puchong" data-name="Puchong" id="myCheckBox4" onchange="checkDisabled(testing);"/> Puchong&nbsp;&nbsp;</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="2" data-id="Kiosk 2" data-name="Kiosk 2" id="myCheckBox5" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 2&nbsp;&nbsp;</label></li> 
                                                                        </ul>
                                                                    </li>   
                                                                    <li><label><input type="checkbox"  data-id="Subang Hub" data-name="Subang Hub" id="myCheckBox6" onchange="checkDisabled(testing);"/> &nbsp;Subang Hub&nbsp;</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="5" data-id="Kiosk 5" data-name="Kiosk 5" id="myCheckBox7" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 5&nbsp;&nbsp;</label></li> 
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="20" data-id="Kiosk 20" data-name="Kiosk 20" id="myCheckBox8" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 20&nbsp;&nbsp;</label></li>
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Bangi" data-name="Bangi" id="myCheckBox9" onchange="checkDisabled(testing);"/> &nbsp;Bangi&nbsp;&nbsp;</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="7" data-id="Kiosk 7" data-name="Kiosk 7" id="myCheckBox10" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 7&nbsp;&nbsp;</label></li>    
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="8" data-id="Kiosk 8" data-name="Kiosk 8" id="myCheckBox11" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 8&nbsp;&nbsp;</label></li>
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Shah Alam" data-name="Shah Alam" id="myCheckBox12" onchange="checkDisabled(testing);"/> &nbsp;Shah Alam&nbsp;&nbsp;</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="9" data-id="Kiosk 9" data-name="Kiosk 9" id="myCheckBox13" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 9&nbsp;&nbsp;</label></li>    
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="10" data-id="Kiosk 10" data-name="Kiosk 10" id="myCheckBox14" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 10&nbsp;&nbsp;</label></li>
                                                                        </ul>
                                                                    </li>   
                                                                    <li><label><input type="checkbox"  data-id="Cheras" data-name="Cheras" id="myCheckBox15" onchange="checkDisabled(testing);"/> &nbsp;Cheras&nbsp;</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="11" data-id="Kiosk 11" data-name="Kiosk 11" id="myCheckBox16" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 11&nbsp;&nbsp;</label></li>    
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="12" data-id="Kiosk 12" data-name="Kiosk 12" id="myCheckBox17" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 12&nbsp;&nbsp;</label></li>
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox"  data-id="Banting" data-name="Banting" id="myCheckBox18" onchange="checkDisabled(testing);"/> Banting</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="13" data-id="Kiosk 13" data-name="Kiosk 13" id="myCheckBox19" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 13&nbsp;&nbsp;</label></li>    
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="14" data-id="Kiosk 14" data-name="Kiosk 14" id="myCheckBox20" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 14&nbsp;&nbsp;</label></li>
                                                                        </ul>
                                                                    </li>   
                                                                    <li><label><input type="checkbox"  data-id="Rawang" data-name="Rawang" id="myCheckBox21" onchange="checkDisabled(testing);"/> Rawang</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="15" data-id="Kiosk 15" data-name="Kiosk 15" id="myCheckBox22" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 15&nbsp;&nbsp;</label></li>    
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="16" data-id="Kiosk 16" data-name="Kiosk 16" id="myCheckBox23" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 16&nbsp;&nbsp;</label></li>
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox"  data-id="Pelabuhan Klang" data-name="Pelabuhan Klang" id="myCheckBox24" onchange="checkDisabled(testing);"/> Pelabuhan Klang</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="17" data-id="Kiosk 17" data-name="Kiosk 17" id="myCheckBox25" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 17&nbsp;&nbsp;</label></li>    
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="18" data-id="Kiosk 18" data-name="Kiosk 18" id="myCheckBox26" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 18&nbsp;&nbsp;</label></li>
                                                                        </ul>
                                                                    </li>   
                                                                    <li><label><input type="checkbox"  data-id="Sungai Besar" data-name="Sungai Besar" id="myCheckBox27" onchange="checkDisabled(testing);"/> Sungai Besar</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="19" data-id="Kiosk 19" data-name="Kiosk 19" id="myCheckBox28" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 19&nbsp;&nbsp;</label></li>    
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox"  data-id="Kuala Selangor" data-name="Kuala Selangor" id="myCheckBox29" onchange="checkDisabled(testing);"/> Kuala Selangor</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="21" data-id="Kiosk 21" data-name="Kiosk 21" id="myCheckBox30" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 21&nbsp;&nbsp;</label></li>    
                                                                        </ul>
                                                                    </li>   
                                                                    <li><label><input type="checkbox" data-id="Sepang" data-name="Sepang" id="myCheckBox31" onchange="checkDisabled(testing);"/> Sepang</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="22" data-id="Kiosk 22" data-name="Kiosk 22" id="myCheckBox32" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 22&nbsp;&nbsp;</label></li>    
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Kajang" data-name="Kajang" id="myCheckBox33" onchange="checkDisabled(testing);"/> Kajang</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="23" data-id="Kiosk 23" data-name="Kiosk 23" id="myCheckBox34" onchange="checkDisabled(testing);"/> &nbsp;Kiosk 23&nbsp;&nbsp;</label></li>    
                                                                        </ul>
                                                                    </li>       
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Putrajaya" data-name="Putrajaya" id="myCheckBox35" onchange="checkDisabled(testing);"/> Putrajaya</label>
                                                                <ul id="navlist">
                                                                    <li><label><input type="checkbox" name="kioskMaster[]" value="24" data-id="Kiosk 24" data-name="Kiosk 24" id="myCheckBox36" onchange="checkDisabled(testing);"/> Kiosk 24</label></li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Kuala Lumpur" data-name="Kuala Lumpur" id="myCheckBox37" onchange="checkDisabled(testing);"/> Kuala Lumpur</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox" data-id="Kepong" data-name="Kepong" id="myCheckBox38" onchange="checkDisabled(testing);"/> Kepong</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="26" data-id="Kiosk 26" data-name="Kiosk 26" id="myCheckBox39" onchange="checkDisabled(testing);"/> Kiosk 26</label></li>
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="27" data-id="Kiosk 27" data-name="Kiosk 27" id="myCheckBox40" onchange="checkDisabled(testing);"/> Kiosk 27</label></li>
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Taman Melawati" data-name="Taman Melawati" id="myCheckBox41" onchange="checkDisabled(testing);"/> Taman Melawati</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="28" data-id="Kiosk 28" data-name="Kiosk 28" id="myCheckBox42" onchange="checkDisabled(testing);"/> Kiosk 28</label></li>
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="29" data-id="Kiosk 29" data-name="Kiosk 29" id="myCheckBox43" onchange="checkDisabled(testing);"/> Kiosk 29</label></li>
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="UTC Pudu" data-name="UTC Pudu" id="myCheckBox44" onchange="checkDisabled(testing);"/> UTC Pudu</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="30" data-id="Kiosk 30" data-name="Kiosk 30" id="myCheckBox45" onchange="checkDisabled(testing);"/> Kiosk 30</label></li>
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="31" data-id="Kiosk 31" data-name="Kiosk 31" id="myCheckBox46" onchange="checkDisabled(testing);"/> Kiosk 31</label></li>
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Dua Sentral" data-name="Dua Sentral" id="myCheckBox47" onchange="checkDisabled(testing);"/> Dua Sentral</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="32" data-id="Kiosk 32" data-name="Kiosk 32" id="myCheckBox48" onchange="checkDisabled(testing);"/> Kiosk 32</label></li>

                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Jalan Klang Lama" data-name="Jalan Klang Lama" id="myCheckBox49" onchange="checkDisabled(testing);"/> Jalan Klang Lama</label>
                                                                        <ul>
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="33" data-id="Kiosk 33" data-name="Kiosk 33" id="myCheckBox50" onchange="checkDisabled(testing);"/> Kiosk 33</label></li>
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="34" data-id="Kiosk 34" data-name="Kiosk 34" id="myCheckBox51" onchange="checkDisabled(testing);"/> Kiosk 34</label></li>
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Pahang" data-name="Pahang" id="myCheckBox52" onchange="checkDisabled(testing);"/> Pahang</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox" data-id="Kuantan" data-name="Kuantan" id="myCheckBox53" onchange="checkDisabled(testing);"/> Kuantan</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="35" data-id="Kiosk 35" data-name="Kiosk 35" id="myCheckBox54" onchange="checkDisabled(testing);"/> Kiosk 35</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="UTC Kuantan" data-name="UTC Kuantan" id="myCheckBox55" onchange="checkDisabled(testing);"/> UTC Kuantan</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="36" data-id="Kiosk 36" data-name="Kiosk 36" id="myCheckBox56" onchange="checkDisabled(testing);"/> Kiosk 36</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Temerloh" data-name="Temerloh" id="myCheckBox57" onchange="checkDisabled(testing);"/> Temerloh</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="37" data-id="Kiosk 37" data-name="Kiosk 37" id="myCheckBox58" onchange="checkDisabled(testing);"/> Kiosk 37</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Bentong" data-name="Bentong" id="myCheckBox59" onchange="checkDisabled(testing);"/> Bentong</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="6" data-id="Kiosk 6" data-name="Kiosk 6" id="myCheckBox60" onchange="checkDisabled(testing);"/> Kiosk 6</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Perak" data-name="Perak" id="myCheckBox61" onchange="checkDisabled(testing);"/> Perak</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox" data-id="Ipoh" data-name="Ipoh" id="myCheckBox62" onchange="checkDisabled(testing);"/> Ipoh</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="38" data-id="Kiosk 38" data-name="Kiosk 38" id="myCheckBox63" onchange="checkDisabled(testing);"/> Kiosk 38</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="UTC Ipoh" data-name="UTC Ipoh" id="myCheckBox64" onchange="checkDisabled(testing);"/> UTC Ipoh</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="39" data-id="Kiosk 39" data-name="Kiosk 39" id="myCheckBox65" onchange="checkDisabled(testing);"/> Kiosk 39</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Taiping" data-name="Taiping" id="myCheckBox66" onchange="checkDisabled(testing);"/> Taiping</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="40" data-id="Kiosk 40" data-name="Kiosk 40" id="myCheckBox67" onchange="checkDisabled(testing);"/> Kiosk 40</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Teluk Intan" data-name="Teluk Intan" id="myCheckBox68" onchange="checkDisabled(testing);"/> Teluk Intan</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="41" data-id="Kiosk 41" data-name="Kiosk 41" id="myCheckBox69" onchange="checkDisabled(testing);"/> Kiosk 41</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Sri Manjung" data-name="Sri Manjung" id="myCheckBox70" onchange="checkDisabled(testing);"/> Sri Manjung</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="42" data-id="Kiosk 42" data-name="Kiosk 42" id="myCheckBox71" onchange="checkDisabled(testing);"/> Kiosk 42</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Kedah" data-name="Kedah" id="myCheckBox72" onchange="checkDisabled(testing);"/> Kedah</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox" data-id="Alor Setar" data-name="Alor Setar" id="myCheckBox73" onchange="checkDisabled(testing);"/> Alor Setar</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="43" data-id="Kiosk 43" data-name="Kiosk 43" id="myCheckBox74" onchange="checkDisabled(testing);"/> Kiosk 43</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="UTC Alor Setar" data-name="UTC Alor Setar" id="myCheckBox75" onchange="checkDisabled(testing);"/> UTC Alor Setar</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="44" data-id="Kiosk 44" data-name="Kiosk 44" id="myCheckBox76" onchange="checkDisabled(testing);"/> Kiosk 44</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Sungai Petani" data-name="Sungai Petani" id="myCheckBox77" onchange="checkDisabled(testing);"/> Sungai Petani</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="45" data-id="Kiosk 45" data-name="Kiosk 45" id="myCheckBox78" onchange="checkDisabled(testing);"/> Kiosk 45</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Kulim" data-name="Kulim" id="myCheckBox79" onchange="checkDisabled(testing);"/> Kulim</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="46" data-id="Kiosk 46" data-name="Kiosk 46" id="myCheckBox80" onchange="checkDisabled(testing);"/> Kiosk 46</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Pulau Pinang" data-name="Pulau Pinang" id="myCheckBox81" onchange="checkDisabled(testing);"/> Pulau Pinang</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox" data-id="Seberang Jaya" data-name="Seberang Jaya" id="myCheckBox82" onchange="checkDisabled(testing);"/> Seberang Jaya</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="47" data-id="Kiosk 47" data-name="Kiosk 47" id="myCheckBox83" onchange="checkDisabled(testing);"/> Kiosk 47</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Pulau Pinang" data-name="Pulau Pinang" id="myCheckBox84" onchange="checkDisabled(testing);"/> Pulau Pinang</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="48" data-id="Kiosk 48" data-name="Kiosk 48" id="myCheckBox85" onchange="checkDisabled(testing);"/> Kiosk 48</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Nibong Tebal" data-name="Nibong Tebal" id="myCheckBox86" onchange="checkDisabled(testing);"/> Nibong Tebal</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="49" data-id="Kiosk 49" data-name="Kiosk 49" id="myCheckBox87" onchange="checkDisabled(testing);"/> Kiosk 49</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Melaka" data-name="Melaka" id="myCheckBox88" onchange="checkDisabled(testing);"/> Melaka</label>
                                                                <ul id="navlist">
                                                                    <li><label><input type="checkbox" data-id="Bandar Melaka" data-name="Bandar Melaka" id="myCheckBox89" onchange="checkDisabled(testing);"/> Bandar Melaka</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="50" data-id="Kiosk 50" data-name="Kiosk 50" id="myCheckBox90" onchange="checkDisabled(testing);"/> Kiosk 50</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="UTC Melaka" data-name="UTC Melaka" id="myCheckBox91" onchange="checkDisabled(testing);"/> UTC Melaka</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="51" data-id="Kiosk 51" data-name="Kiosk 51" id="myCheckBox92" onchange="checkDisabled(testing);"/> Kiosk 51</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="TNB Jasin" data-name="TNB Jasin" id="myCheckBox93" onchange="checkDisabled(testing);"/> TNB Jasin</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="25" data-id="Kiosk 25" data-name="Kiosk 25" id="myCheckBox94" onchange="checkDisabled(testing);"/> Kiosk 25</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Perlis" data-name="Perlis" id="myCheckBox95" onchange="checkDisabled(testing);"/> Perlis</label>
                                                                <ul id="navlist">
                                                                    <li><label><input type="checkbox" name="kioskMaster[]" value="52" data-id="Kiosk 52" data-name="Kiosk 52" id="myCheckBox96" onchange="checkDisabled(testing);"/> Kiosk 52</label></li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Negeri Sembilan" data-name="Negeri Sembilan" id="myCheckBox97" onchange="checkDisabled(testing);"/> Negeri Sembilan</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox" data-id="Seremban" data-name="Seremban" id="myCheckBox98" onchange="checkDisabled(testing);"/> Seremban</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="53" data-id="Kiosk 53" data-name="Kiosk 53" id="myCheckBox99" onchange="checkDisabled(testing);"/> Kiosk 53</label></li>                                                              
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Nilai" data-name="Nilai" id="myCheckBox100" onchange="checkDisabled(testing);"/> Nilai</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="54" data-id="Kiosk 54" data-name="Kiosk 54" id="myCheckBox101" onchange="checkDisabled(testing);"/> Kiosk 54</label></li>                                                             
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Kelantan" data-name="Kelantan" id="myCheckBox122" onchange="checkDisabled(testing);"/> Kelantan</label>
                                                                <ul id="navlist">
                                                                    <li><label><input type="checkbox" name="kioskMaster[]" value="62" data-id="Kiosk 62" data-name="Kiosk 62" id="myCheckBox123" onchange="checkDisabled(testing);"/> Kiosk 62</label></li>
                                                                </ul>
                                                            </li>
                                                            <hr/>
                                                            <li>
                                                                <label><input type="checkbox" data-id="Terengganu" data-name="Terengganu" id="myCheckBox124" onchange="checkDisabled(testing);"/> Terengganu</label>
                                                                <ul id="navlist">
                                                                    &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;<li><label><input type="checkbox" data-id="Terengganu" data-name="Terengganu" id="myCheckBox125" onchange="checkDisabled(testing);"/> Terengganu</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="63" data-id="Kiosk 63" data-name="Kiosk 63" id="myCheckBox126" onchange="checkDisabled(testing);"/> Kiosk 63</label></li>                                                             
                                                                        </ul>
                                                                    </li>
                                                                    <li><label><input type="checkbox" data-id="Kemaman" data-name="Kemaman" id="myCheckBox127" onchange="checkDisabled(testing);"/> Kemaman</label>
                                                                        <ul >
                                                                            <li><label><input type="checkbox" name="kioskMaster[]" value="64" data-id="Kiosk 64" data-name="Kiosk 64" id="myCheckBox128" onchange="checkDisabled(testing);"/> Kiosk 64</label></li>                                                             
                                                                        </ul>
                                                                    </li>
                                                                </ul>
                                                            </li>
                                                        </ul>
                                                    </li>
                                                </ul>
                                            </div>

                                            <div>
                                                <p>Selected items (readable): <span class="selected-readable" id="selected-readable"></span></p>
                                                <p>Selected items: <span class="selected">[]</span></p>
                                                <p>Excepted items: <span class="excepted">[]</span></p>
                                            </div>                  
                                            <div class="checkbox">
                                                <input type="hidden" name="modeType" value="0"> 
                                                <button id="testing" type="submit" class="btn btn-primary" onclick="return submitForm()" disabled>Submit </button>
                                            </div>
                                            <div id="myResponse"></div>
                                        </form>

Here are the javascript i'm trying to play around with the submit disable and enable function :

<script type='text/javascript'>

        function checkDisabled(yourSubmitButton){

          for(var i=0;i<=128;i++){
              if(document.getElementById("myCheckBox"+i).checked==true){
                  yourSubmitButton.disabled = false;              
              }
          } 

           for(var i=0;i<=128;i++){

              if(document.getElementById("myICheckBox"+i).checked==true){
                  yourSubmitButton.disabled = false;

              } 
          } 

          };
          </script> 

I had try few ways but it have some problem through. And it was a nested checkbox, I'm still new to javascript so i not really sure am i doing it on correct way or not. Due to limitation of word count in stackoverflow, i had removed some of the checkbox code which is duplicate. Thanks