samedi 31 octobre 2015

If/else event (changing file path) not changing when checkbox checked...

rhythm A and rhythm B with checkbox

On my website, a user chooses 2 rhythms from among 100 different choices (each of which has a unique id. In the image above, as you can see, the user has selected rhythm 2.5 and rhythm 5.8. There is an audio file associated with each rhythm, which can be played by clicking the play button. Actually, there are TWO audio files associated with each rhythm -- a straight version and a swing version. When the user clicks the "swing it" checkbox, I want the swing version to play. Otherwise, I want the straight version to play. The names of the straight and swing audio files are identical ("2.5.mp3", for example), but the straight version is called at "audio/2.5.mp3" and the swing version is called at "audio/swing/2.5.mp3".

I've looked at many SO posts, but my code's not working. I would love some help! Here's my HTML:

<div class="playRow">               
    <div class="rhythms_AandB">
        <div class="currentSelection">
            <div class="playFeatured"><audio id="playA" preload='none'></audio>
                <button class="featuredAudio" onclick="document.getElementById('playA').play()">&#x25b6;</button></div> 
            <div class="selectedLabelA" id="currentLabelA">A</div>
            <div class="selectedRhythm currentRhythm_A" id="currentRhythm_A"></div>
        </div>

        <div class="currentSelection">
            <div class="playFeatured"><audio id="playB" preload='none'></audio>
                <button class="featuredAudio" onclick="document.getElementById('playB').play()">&#x25b6;</button></div> 
            <div class="selectedLabelB" id="currentLabelB">B</div>
            <div class="selectedRhythm currentRhythm_B" id="currentRhythm_B"></div>
        </div>
</div>  
<div class="swingRow">
        <input type="checkbox" name="swingBox" id="swingBox" class="css-checkbox" /><label for="swingBox" class="css-label">Swing it <a href="" id="swing-tooltip" data-tipped-options="position: 'bottom'">(?)</a></label>
        </div>  
</div>

And here is my js:

$(document).ready(function() {  
var activeRhythmA = document.getElementById('currentLabelA');
var activeRhythmB = document.getElementById('currentLabelB');
function swingIt() {
    if(document.getElementById('swingBox').checked) {
    $('#playA').html("<source src='audio/swing/" + activeRhythmA + ".mp3' type='audio/mpeg' /><source src='audio/swing/" + activeRhythmA + ".ogg' type='audio/ogg' />"); $('#playA').load();
    $('#playB').html("<source src='audio/swing/" + activeRhythmB + ".mp3' type='audio/mpeg' /><source src='audio/swing/" + activeRhythmB + ".ogg' type='audio/ogg' />"); $('#playB').load();
    }
    else {
    $('#playA').html("<source src='audio/" + activeRhythmA + ".mp3' type='audio/mpeg' /><source src='audio/" + activeRhythmA + ".ogg' type='audio/ogg' />"); $('#playA').load();
    $('#playB').html("<source src='audio/" + activeRhythmB + ".mp3' type='audio/mpeg' /><source src='audio/" + activeRhythmB + ".ogg' type='audio/ogg' />"); $('#playB').load();    
    }
};
});




Placement of checkbox label

I want the check box label to appear before the checkbox. The issue is, I can't make use of the attribute for="checkbox id" in label, unless the label comes after the check box. I strictly need to use the combination of check box and label, i.e. I can't use nested label or a check box with < p> or < span> before it. Can someone aid in this. Thank you.

<input type="checkbox" id="chk1" />
<label for="chk1">I agree</label>



CSS checkbox: click one label, change two things inside one button

I looked at similar posts, but they use JavaScript. I need to use HTML and CSS only.

How can I make a two labels change with the click of one label? (I think that's the process.)

This is for a button in a navigation bar that 1) changes from "Main >" to "Directory <" on click, then 2) toggles a drop-down box that floats above the body content. 3) Clicking "Main" will direct to the "Main" page, clicking ">" will toggle the button to change to "Directory <", clicking "Directory" will open the drop-down and clicking "<" will change to button back to "Main >" (closing the drop-down box if open).

I can't show the code I have right now because it's an embarrassing beginner mess in its early stage. Suggest away!




How to use checkboxes with nested form helpers - multiple answer input in survey app

I'm working my way through a (what I thought was) basic survey app and I've run into a little pickle.

Basically I want to allow my Poll app to be able to accept multiple answers via checkboxes. I've gotten to the point where I can input answers but it's passing an incrementing checkbox id (first one is 0, second is 1 etc) and it's not creating multiple records when multiple boxes are checked. Any help would be greatly appreciated.

form.html.erb

<label>
  <%= c.object.question.title %>
</label>
<div class="radio">
  <% c.object.question.possible_answers.each do |possible_answer| %>
    <p>
      <label>
        <%= possible_answer.title %>
        <%= c.check_box :possible_answer_id %>
        <%= c.hidden_field :question_id %>
      </label>
    </p>
  <% end %>
</div>

replies_controller.rb

class RepliesController < ApplicationController

  before_action :set_exam

  def new
    @reply = @exam.replies.build
    @exam.questions.each do |question|
      @reply.answers.build question: question
    end
  end

  def create
    @reply = @exam.replies.build(reply_params)
    if @reply.save
      redirect_to @exam, notice: "Thank you for completing the exam"
    else
      render :new
    end
  end

  private

  def set_exam
    @exam = Exam.find params[:exam_id]
  end

  def reply_params
    params.require(:reply).permit(:exam_id, { answers_attributes: [:value,      :question_id, :reply_id, :possible_answer_id] })
  end

end




Replicating a select element with a checkbox ul (jQuery)

I'm trying to transform a fieldset with one legend and one UL of checkboxes/radio as a select html element. I know, it sounds bad and doesn't really make sense, but let's just say I have to do it.

I have a jsfiddle http://ift.tt/1Wq7bMi

The problem is that I have some issues replicating the click behavior of the select element. I don't find the right selector to make it so a click on a checkbox wont make the fake select box disappear.

(function($) {

    $(document).ready(function() {

        $('fieldset legend').on('click', function() {
            var $this = $(this);
            $this.toggleClass('active');
            $this.next().toggleClass('visible');
        })


        $(document).on('click', function (e) {
            if($('ul').hasClass('visible') && !$('fieldset legend').is(e.target)) {
                $('ul').removeClass('visible');
                $('legend').removeClass('active');
            }
        });



    })

})(jQuery);




PreviewKeyDown of checkbox in Multi Select ComboBox in WPF

I use this article for created multi select combobox.

I want to select/unselect checkbox when press Space in a item.

I add PreviewKeyDown in CheckBox but don't raise this.

I add PreviewKeyDown in StackPanel but don't get selected item.




Webix - Deleting selected Checkboxes in Datatables

I have a datatable with checkboxes for which I want to delete the underlying records in MySQL database when I select the boxes/rows and hit the 'delete' button.

I was able to make it work with the .remove function. But when I reloaded the deleted rows came back. Of course these records were not deleted in my database.

Here I made a simple version of the datatable: http://ift.tt/1PblTq4

Could somebody please help me do this?




foreach checkboxes assign value

Currently, I have a Table, to facilitate appointment booking, based on the data from the Dataset.

The table columns is based on the number of Table Data from [Object] and rows is from 9am to 9pm, 1 row per hour.

For each rows, I've added checkbox : for eg: if users checked checkboxes from 2-6, then I will be blocking off the timeslots

                foreach (DataRow objectrow in ds.Tables["Object"].Rows)
                {
                    myTableCell = new TableCell();
                    CheckBox cb = new CheckBox();
                    myTableCell.Controls.Add(cb);
                    myTableRow.Cells.Add(myTableCell);
                }

However, I have problems assigning the id of the checkboxes and I'm confused on how to achieving it due to multiple objects in the database.

To test the codes, I've assigned Label.Text to check whether any checkboxes is selected. I've tried looping through foreach(rows) then (cell) then (Control) but still wasn't able to get it to work.

Appreciate any feedback as I'm new at programming




vendredi 30 octobre 2015

combining multiple checkboxes to sql query

I have a collection of games and now I want to filter them with a SQL Query. I have a checkboxes formular divided by categories "numbers of players", "type of game", "duration" etc. So my SQL query needs to combine checkboxes within a categorie and exclude across the category.

For example: If someone checks a game for "1-5 Players" and "5-10 Players" which lasts for "5 Minutes" which is also "Ball Game" and "Water Game" I want to output all the Games which are number_of_players "1-5 Players" OR "5-10 Players" AND duration = "5 Minutes" AND type_of_game = "Ball Game" OR "Water Game"

But as well, there's the possibility to check nothing. Example: If someone doesn't check anything at all for the duration but checks "5 Minutes" as well as "Ball Game" and "Water Game" I want to output all the games which are duration = "5 Minutes" AND type_of_game = "Ball Game" OR "Water Game".

I think I have to add some sort of priority to the categories. The first selected category always defines the "mass" and the other checkboxes limits this mass.




C# WPF Binding CheckBox in GridData to underlying Array, data not changed

Very new to WPF. Having issues with Binding a CheckBox to the underlying Array data. The value gets set at start up with the data, but checking it does not result in the underlying data to be changed. Note that I have implemented the check box to allow multiple items to be selected. Also note that I have verified that it is not because of focus (checkbox having to lose focus) because I have clicked other stuff before hitting the "migrate" button which checks the underlying data. I am sure I am missing some autowire magic, but I have checked out a ton of other blogs with no success.

The check box not working is :

       <DataGridTemplateColumn Width="60" Header="Migrate">
            <DataGridTemplateColumn.CellTemplate>
                <DataTemplate>
                    <CheckBox IsChecked="{Binding Checked}" />
                </DataTemplate>
            </DataGridTemplateColumn.CellTemplate>
        </DataGridTemplateColumn>

The code is pretty simple, MainWindow.xaml:

<Window x:Class="FFFJsonMigrator.MainWindow"
        xmlns="http://ift.tt/o66D3f"
        xmlns:x="http://ift.tt/mPTqtT"
        xmlns:d="http://ift.tt/pHvyf2"
        xmlns:mc="http://ift.tt/pzd6Lm"
        xmlns:Code="clr-namespace:FFFJsonMigrator.Code"
        mc:Ignorable="d"
        Title="JSON Migrator" Height="482" Width="729">
    <Grid Background="#FF9DB2C1" Margin="0,0,2,-21">
        <Grid.DataContext>
            <Code:FFFJsonMigrator/>
        </Grid.DataContext>
        <DataGrid x:Name="dataGrid"  ItemsSource="{Binding myAccountList}" SelectionMode="Extended" HorizontalAlignment="Left" Margin="10,63,0,0" VerticalAlignment="Top" Height="352" Width="685" CanUserReorderColumns="False" CanUserResizeColumns="False" CanUserSortColumns="False" HeadersVisibility="Column" AlternatingRowBackground="#FFE7F3FA" AlternationCount="1" CanUserAddRows="False" CanUserDeleteRows="False" CanUserResizeRows="False" ColumnWidth="Auto" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTemplateColumn Width="60" Header="Migrate">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <CheckBox IsChecked="{Binding Checked}" />
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                </DataGridTemplateColumn>
                <DataGridTextColumn Binding="{Binding Id}" IsReadOnly="True"  Header="Id" Width="40"/>
                <DataGridTextColumn Binding="{Binding AccountName}" IsReadOnly="True"  Header="Account Name" Width="250"/>
                <DataGridTextColumn Binding="{Binding Forms}"  IsReadOnly="True"  Header="Forms" Width="60"/>
                <DataGridTextColumn Binding="{Binding Pending}"  IsReadOnly="True"  Header="Pending"  Width="60"/>
                <DataGridTextColumn Binding="{Binding Archived}" IsReadOnly="True"   Header="Archived"  Width="60"/>
                <DataGridTextColumn Binding="{Binding Total}"  IsReadOnly="True"  Header="Total"  Width="60"/>
            </DataGrid.Columns>
        </DataGrid>
        <ComboBox x:Name="envComboBox" HorizontalAlignment="Left" Margin="10,32,0,0" VerticalAlignment="Top" Width="120"/>
        <Button x:Name="refreshButton" Content="Refresh" HorizontalAlignment="Left" Margin="144,32,0,0" VerticalAlignment="Top" Width="75"/>
        <CheckBox x:Name="activeOnlyCheckbox" Content="Active Accounts Only" HorizontalAlignment="Left" Margin="14,427,0,0" VerticalAlignment="Top"/>
        <Button x:Name="migrateButton" Command="{Binding MigrateCommand}" IsEnabled="True" Content="Migrate Forms" HorizontalAlignment="Left" Margin="506,424,0,0" VerticalAlignment="Top" Width="75"/>
        <TextBlock x:Name="textBlock" HorizontalAlignment="Left" Margin="236,10,0,0" TextWrapping="Wrap" Text="Select the accounts to be migrated. The JSON in the Form, FormArchive and FormPending tables will be copied to Azure and the path to the file added to the JsonPath columns" VerticalAlignment="Top" Width="353"/>
    </Grid>
</Window>

The FFFJsonMigrator.cs :

using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Windows;
using System.Windows.Input;

namespace FFFJsonMigrator.Code
{
    public class FFFJsonMigrator : INotifyPropertyChanged
    {
        public ObservableCollection<AccountData> myAccountList { get; set; }

        public FFFJsonMigrator()
        {
            myAccountList = new ObservableCollection<AccountData>();
            myAccountList.Add(new AccountData(false, "Test1", 1232344, 2, 3, 4, 9));
            myAccountList.Add(new AccountData(false, "Test2", 2222345, 1, 1, 1, 3)); ;
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void NotifyPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        private void MigrateMessage()
        {
            if (IsAnyToMigrate())
            {
                // Configure the message box to be displayed
                string messageBoxText = "Qre you sure you want to Migrate the selected Account JSON files?";
                string caption = "Migrate Json Files for Selected Accounts";
                MessageBoxButton button = MessageBoxButton.YesNo;
                MessageBoxImage icon = MessageBoxImage.Warning;

                // Display message box
                MessageBoxResult result = MessageBox.Show(messageBoxText, caption, button, icon);

                if (result == MessageBoxResult.Yes)
                {
                    ExecuteMigrate();
                }
            }
            else
            {
                // Configure the message box to be displayed
                string messageBoxText = "You have not chosen any accounts to migrate. Please select one or more Accounts to migrate.";
                string caption = "No Accounts To Migrate";
                MessageBoxButton button = MessageBoxButton.OK;
                MessageBoxImage icon = MessageBoxImage.Warning;

                // Display message box
                MessageBox.Show(messageBoxText, caption, button, icon);
            }

        }

        public bool IsAnyToMigrate()
        {
            foreach (AccountData accnt in myAccountList)
            {
                if (accnt.Checked)
                    return true;

            }
            return false;
        }

        private ICommand _migrateCommand;
        public ICommand MigrateCommand
        {
            get
            {
                return _migrateCommand ?? (_migrateCommand = new CommandHandler(() => MigrateMessage(), true));
            }
        }

        public class CommandHandler : ICommand
        {
            private Action _action;
            private bool _canExecute;
            public CommandHandler(Action action, bool canExecute)
            {
                _action = action;
                _canExecute = canExecute;
            }

            public bool CanExecute(object parameter)
            {
                return _canExecute;
            }

            public event EventHandler CanExecuteChanged;

            public void Execute(object parameter)
            {
                _action();
            }
        }
    }

    public class AccountData
    {
        public AccountData(bool check, string accountName, int id, int forms, int pending, int archived, int total)
        {
            AccountName = accountName;
            Id = id;
            Forms = forms;
            Pending = pending;
            Archived = archived;
            Total = total;
            Checked = check;
        }

        public bool Checked { get; set; }
        public string AccountName { get; set; }
        public int Id { get; set; }
        public int Forms { get; set; }
        public int Pending { get; set; }
        public int Archived { get; set; }
        public int Total { get; set; }
    }
}

And finally, the actual window itself. Note I am doing the check then the "Migrate" button is hit...

enter image description here




Add sap.ui.commons.CheckBox onto a sap.m.page

I'm new to SAPUI5 and want to make a page, with contains several CheckBoxes, based on SAPUI5. At this moment I have following code to create the CheckBoxes:

function chosevalues(){
        re_items = [];

        var items = [];
        var text = ["1070","1071","1072","1073","1074","1075","1076"];

        for (var i = 0; i < text.length; i++) {
            alert("in for with i= " + i);
            var box = new sap.ui.commons.CheckBox({
                                text : text[i],
                                tooltip : 'Value checkbox',
                                checked : false,
                                change : function() {
                                    if(oCB.getChecked()){
                                        alert(this.getText());
                                        re_items.push(this.getText());
                                    }else{
                                        alert('NO');
                                    }
                                }
                });
                items.push(box);
        }
        page4.addContent(items);
        app.to("page4");
    }

Now I place the array on the page-content, but the text and the boxes are very small. I tried with a sap.ui.table.Table and also with a sap.m.List. Nothing worked. It should be like this: SAPUI5 Explored - CheckBox But I found no way to include the mvc-view in my javascript code.

On the one hand I can programm with javascript to create the CheckBoxes like the example, and on the other hand I can try to include the mvc-view. The Problem is, that I have no idea for both.




Kendo Grid Filter ItemTemplate with multiCheck get checkbox state

I have no Idea how to formulate this question better, but this is the scenario:

I'm working on a big webapp for a client that uses telerik kendo UI for the grid. One of the columns in the grid is set to filter and uses multiCheck. So far everything works well and I'm happy with the result.

Now for the kicker though: The checkboxes were styled (which means they are hidden and a surrounding container diplays the value) and work for the first time you use the filter, since none of the checkboxes are selected. Once I select some values and filter the grid, the filter menu is being redrawn and the selected checkboxes are being emptied.

What I need to do now is have a condition in the itemTemplate to set the class that shows the checkbox value.

My current itemTemplate looks like this:

function documentTypeItemTemplate(e) {
    var s = "<div class='checker'>";
    s += "<span tabindex='0' role='checkbox' aria-checked='false'>";
    s += "<input id='filter_" + e.field + "' type='checkbox' value='#=Value#' name='" + e.field + "' onchange='Wpl.SettingsContext.CheckboxChanged(this);' tabindex='-1' aria-hidden='true' />";
    s += "<label for='filter_" + e.field + "'>#=Text#</label></span></div>";
    return s;
}

but for a checked Checkbox I would need it to look like:

function documentTypeItemTemplate(e) {
    var s = "<div class='checker'>";
    s += "<span tabindex='0' class="checked" role='checkbox' aria-checked='true'>";
    s += "<input id='filter_" + e.field + "' type='checkbox' value='#=Value#' name='" + e.field + "' onchange='Wpl.SettingsContext.CheckboxChanged(this);' tabindex='-1' aria-hidden='true' />";
    s += "<label for='filter_" + e.field + "'>#=Text#</label></span></div>"";
    return s;
}

Does anyone have a clue if that's possible at all? I went through the whole Kendo UI Page twice and didn't get any information on itemTemplate apart from the basic definition of it.

Thanks for your help

Cheers H.2.O




How to store values(i.e. 'Y'- for checked, 'N' - for unckecked) of multiple checkbox in database using angularjs?

I've attached the screenshot of my module. I want the store the values('Y','N') of selected checkbox in database

<tr data-ng-repeat="data in RoleOperation track by $index">
    <td>{{$index + 1}}</td>
    <td>
        <label>{{RoleOperation[$index].vname}}</label>
    </td>
    <td>
        <label>{{RoleOperation[$index].id}}</label>
    </td>

    <td class="text-center">
        <input type="checkbox" data-ng-model="data.viewflg[$index]" />
    </td>
    <td class="text-center">
        <input type="checkbox" data-ng-model="data.addflg[$index]" />
    </td>
    <td class="text-center">
        <input type="checkbox" data-ng-model="data.editflg[$index]" />
    </td>
    <td class="text-center">
        <input type="checkbox" data-ng-model="data.deleteflg[$index]" />
    </td>
</tr>

How to give value to data-ng-model? And how to access particular checkbox in controller? plz help me..




Get list of checked checkboxes from recyclerview android

I have populated the recyclerView with image, title and checkbox. I have two problems.

  1. How to make the checkbox selected when the imageview or the whole recycler item is clicked.

  2. I have to go to next activity by getting all the checked items from the recyclerview.

My layout :

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="8dp">

        <ImageView
            android:id="@+id/image"
            android:layout_width="match_parent"
            android:layout_height="150dp"
            android:layout_gravity="center_horizontal"
            android:contentDescription="Interests"
            android:scaleType="centerCrop"
            android:src="@drawable/ic_yash_dp" />

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_alignParentLeft="true"
            android:layout_alignParentStart="true"
            android:layout_gravity="bottom"
            android:layout_margin="5dp"
            android:layout_marginTop="24dp"
            android:background="@drawable/rounded_corners"
            android:gravity="bottom"
            android:padding="5dp"
            android:text="GYM"
            android:textAlignment="center"
            android:textColor="@color/white" />

        <CheckBox
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/checkBox"
            android:layout_margin="2dp"
            android:layout_alignParentTop="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="true" />

    </RelativeLayout>

My adapter:

@Override
public void onBindViewHolder(RecyclerViewHolder holder, int position) {
final InterestBean model = arrayList.get(position);
final int pos = position;

RecyclerViewHolder mainHolder = (RecyclerViewHolder) holder;// holder

Bitmap image = BitmapFactory.decodeResource(context.getResources(),
        model.getImage());// This will convert drawbale image into bitmap

// setting title
mainHolder.title.setText(model.getTitle());
mainHolder.imageview.setImageBitmap(image);
mainHolder.checkBox.setChecked(arrayList.get(position).isSelected());
mainHolder.checkBox.setTag(arrayList.get(position));


mainHolder.checkBox.setOnClickListener(new View.OnClickListener()     {
public void onClick(View v) {
CheckBox cb = (CheckBox) v;
InterestBean contact = (InterestBean) cb.getTag();

contact.setIsSelected(cb.isChecked());
arrayList.get(pos).setIsSelected(cb.isChecked());
selectedItems.add(pos);
Toast.makeText(
v.getContext(), pos + cb.isChecked(), Toast.LENGTH_LONG).show();
}
});}




Pass checkbox value to angular's ng-click

Is there a way to pass to angular directive ng-click the value of the associated input?

In other words, what should replace this.value in the following:

<input type="checkbox" id="cb1" ng-click="checkAll(this.value)" />

PS. I don't want a workaround to alternate values, I just wonder if is possible to pass a value of an input as argument to a angular function.




Based On First Checkbox list value 2nd checkbox should come dynamically Using angularjs?

i am new to this technology please any one help me out.i have two different checkbox list 1st one is Select Stores 2nd one is Select your device Company name .baesd on first checkbox checked value 2nd(Select your device Company name) checkbox list should come achievements: achievement :Based on first check box list(Select Stores) values 2nd checkbox(Select your device Company name) list should come

Example1: if i select Sai Stores in Select Stores list .Select your device Company name list should show only Sai Stores

Example2 : if i select Sai Stores,Sri Ram Stores in Select Stores list .Select your device Company name list should show Sai Stores and Sri Ram Stores

Example3 :

if nothing is select in that Select Stores list . Select your device Company name list should be hide or not visible

Example 4:now i have already selected Sai Stores in Select Stores list.Select your device Company name list should show only Sai Stores .here instead of that its showing both in Select your device Company name list

if matched then only second list of checkbox should show other wise it should be hidden http://ift.tt/1MXlq6m

var app = angular.module("myApp", []);
    app.controller("Test1Controller", function($scope) {
    var serverData = ["Sai Stores", "Sri Ram Shop", "Ragava Stores","Baba DHl Shop"];
    $scope.items = [];
        var selectedStore = 'Sai Stores';
        $scope.itemChecked = false;
                for (var i = 0; i < serverData.length; i++) {
                    var modal = {
                        name: serverData[i],
                        selected: false

                    };
                  if (selectedStore.indexOf(serverData[i]) >= 0 ) {
                        modal.selected = true;

                    }

                    $scope.items.push(modal);
                   
                }

        $scope.itemsChecked = function() {
            $scope.itemChecked = false;
            for (var i = 0; i < $scope.items.length; i++) {
                if ($scope.items[i].selected) {
                    $scope.itemChecked = true;
                }
            }
        }
//-----------------------------------------------------------------------------------------------------
$scope.stores = [{

        id: "1",
        storeid: "86754634",
        storename: "Sai Stores",
                servicedevice:"Htc"
        
    }, {
         id: "2",
        storeid: "3746579",
        storename: "Sri Ram Stores",
                servicedevice:"Samsung"
    }

    ]
//-----------------------------------------------------------------------------------------------------
        $scope.check = function() {
            var checkedItems = [];
            for (var i = 0; i < $scope.items.length; i++) {
                if ($scope.items[i].selected) {
                    checkedItems.push($scope.items[i].name);
                }
            }
            console.log(checkedItems);
        }
                $scope.check1 = function() {
            var checkedItems1 = [];
            for (var i = 0; i < $scope.stores.length; i++) {
                if ($scope.stores[i].selected) {
                    checkedItems1.push($scope.stores[i].servicedevice);
                }
            }
            console.log(checkedItems1);
        }
    });
<script src="http://ift.tt/1bdM3QL"></script>
<div ng-app="myApp">
    <form name="projectForm">
        <div ng-controller="Test1Controller">
             <label>Select Stores</label>
            <div ng-repeat="item in items">
                <input type="checkbox" ng-model="item.selected" ng-change="itemsChecked()" required="" />{{item.name}}</div><br><br><br>
            <label>Select your device Company name</label>
                         <div ng-repeat="store in stores">
                <input type="checkbox" ng-model="store.selected"  required="" />{{store.storename}}</div>
                                <div class="form-error" ng-messages="projectForm.booktime.$error">
                <div class="form-error" ng-message="required" ng-show="!itemChecked">* Mandatory</div>
            </div>
            <input type="button" name="submit" value="submit" ng-disabled="!itemChecked" ng-click="check();check1" />
        </div>
    </form>
  </div>



Ext JS Checkbox in Roweditor

does anybody know how to set the checkbox in a RowEditor into the center position? I use the theme "triton" with Ext JS 6.0.0.

The checkbox is placed to the top of the row, but the other fields like textfield or combobox are placed to center.

It looks like:

enter image description here

i already set the style object of the checkbox to align: center but it didn't work.

plugins: { ptype: 'rowediting', clicksToEdit: 2, saveBtnText: 'Übernehmen', cancelBtnText: 'Abbrechen' },

initComponent: function() {
    var me = this;
    me.store = 'MeasurementPoint';
    me.columns = [
        {
            xtype: 'actioncolumn',
            width: 50,
            sortable: false,
            hideable: false,
            resizable: false,
            menuDisabled: true,
            draggable: false,
            items: [
                {
                    icon: 'Content/images/icon_32/garbage.png',
                    tooltip: 'Löscht den Eintrag',
                    handler: function(view, rowIdx, colIdx, item, ev, record) {
                        Ext.Msg.show({
                            title: 'Löschen bestätigen!',
                            msg: 'Soll der Messpunkt \"' + record.data.Name + '\" wirklich gelöscht werden?',
                            width: 300,
                            buttons: Ext.Msg.YESNO,
                            fn: function(btn) { if (btn === 'yes') view.ownerCt.getStore().remove(record); },
                            //animateTarget: rowIdx,
                            icon: Ext.window.MessageBox.QUESTION
                        });

                    }
                },
                {
                    icon: 'Content/images/icon_32/pencil.png',
                    tooltip: 'Bearbeitet den Eintrag',
                    handler: function(view, rowIdx, colIdx, item, ev, record) {
                        if (this.__form)
                            return;

                        this.__form = Ext.widget('window', {
                            layout: 'fit',
                            width: 500,
                            title: 'Messpunkt bearbeiten',
                            items: { xtype: 'measurementpointform', header: false },
                        }).show();
                        this.__form.down('button[itemId=save-measurementpoint]').action = 'update-measurementpoint';
                        this.__form.down('form').loadRecord(record);
                        this.__form.on('close', function() { this.__form = false }, this, { single: true });
                    }
                }
            ]
        },
        {
            xtype: 'gridcolumn',
            dataIndex: 'Active',
            text: 'Aktiv',
            width: 70,
            renderer: AWA.ImageRenderer.CROSS,
            editor: {
                xtype: 'checkbox',
            }
        },
        {
            xtype: 'gridcolumn',
            dataIndex: 'Manually',
            text: 'Manuell',
            width: 90,
            renderer: AWA.ImageRenderer.TICK,
            editor: {xtype: 'checkbox'}
        }

Thank you guys for helpful anwers




How to add CheckBox content from resource file in wpf?

I have a combobox in which first item is checkbox to select all entries from below drop down list. With hard coded string its working fine but now I want to localize it...want to set string from resource file but as its deeply inserted couldn't add it. For that I tried adding panel and one checkbox along with textblock also simply separated textblock from checkbox.

This is code :

        <ComboBox Name="CmbEntries" IsTabStop="{Binding CurrentDialogViewModel, Converter={StaticResource NullToBoolConverter}}" Grid.Column="1" Grid.Row="4" VerticalAlignment="Top" Margin="2,0,0,5" SelectedItem="{Binding SelectedEntries}" SelectedIndex="0" HorizontalAlignment="Left" Width="400">
            <ComboBox.Resources>
                <CollectionViewSource x:Key="EntriesCollection" Source="{Binding DicomDir.Entries}"/>
            </ComboBox.Resources>
            <ComboBox.ItemsSource>
                <CompositeCollection>
                    <ComboBoxItem>
                        <CheckBox x:Name="all" Margin="8,0,0,0" 
                                  IsChecked="{Binding IsAllEntriessSelected, Mode=TwoWay}"
                                  Command="{Binding SelectAllEntriessCommand}"
                                  CommandParameter="{Binding IsChecked, RelativeSource={RelativeSource Self}}"
                                  **Content="Select All Entries"** />
                    </ComboBoxItem>
                    <CollectionContainer Collection="{Binding Source={StaticResource EntriesCollection}}"/>
                </CompositeCollection>
            </ComboBox.ItemsSource>
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <StackPanel Orientation="Horizontal">
                        <CheckBox Margin="8,0,0,0" 
                                  IsChecked="{ Binding Path=IsAnyEntitySelected, Mode=TwoWay }"
                                  Command="{Binding SelectAllEntityCommand}"
                                  CommandParameter="{Binding IsChecked, RelativeSource={RelativeSource Self}}" />
                        <TextBlock Margin="5,0,0,0" TextWrapping="Wrap" Text="{Binding DisplayEntriesInfo}"/>
                    </StackPanel>
                </DataTemplate>
            </ComboBox.ItemTemplate>
            <ComboBox.ItemContainerStyle>
                <Style TargetType="ComboBoxItem">
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding HasSelectedEntities}" Value="True">
                            <Setter Property="FontWeight" Value="Bold"/>
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </ComboBox.ItemContainerStyle>
        </ComboBox>

In this case, is it possible to read it directly from resource file?




jeudi 29 octobre 2015

how to checkall and delete using jquery

i am using checkall box for check all and deleteing the content. manual selecting and deleting works fine but dont have idea for check all all the value after checking in checkall and delete those item. anybody have idea? please reply

   <div class="col-md-10  mail-right-box">
        <div class="mail-options-nav">
            <div class="input-group select-all" >
                                    <span class="input-group-addon disabled">
                                        <input type="checkbox" id="checkAll" <?php if($pagetitle=="Trash") echo "disabled"?>>
                                    </span>
                <div class="input-group-btn">
                    <button type="button" class="btn btn-default dropdown-toggle <?php if($pagetitle=="Trash") echo "disabled"?>" data-toggle="dropdown" tabindex="-1">
                        <span class="caret"></span>
                        <span class="sr-only">Toggle Dropdown</span>
                    </button>
                    <ul class="dropdown-menu" role="menu">
                        <li><a href="#">Delete</a></li>
                    </ul>
                </div>
            </div><!-- /input-group -->
            <div class="btn-group mail-options">
                <a href="#" class="btn btn-danger <?php if($pagetitle=="Trash") echo "disabled"?>" id="deleteButton"><i class="fa fa-trash-o" ></i> Delete</a>
            </div>
            <div class="mails">
            <table class="table table-hover table-condensed">
                <th></th>
                <th> Subject</th>
                <th>Message</th>
                <th>Email Address</th>
                <th>Date and Time</th>
                <?php
                if(count($inMessages)>0)

                    foreach($inMessages as $m):
                        ?>
                    <!-- php if($m->from!=0 && $m->to!=1): ?> -->
                        <tr class="checkbox1" data-check="<?php echo $m->address?>"  data-to="<?php echo $m->address?>" data-id="<?php echo $m->sn?>" <?php if($m->flag==1) echo "class=\"read\""?><?php if($m->flag==0) echo "class=\"unread\""?> >
                            <td ><?php if($pagetitle!="Trash"):?><i class="fa fa-check-square-o fa-square-o disabled" data-id="<?php echo $m->sn?>"></i><?php endif?></td>
                            <td class="subject"><?php echo $m->subject?></td>
                            <td class="body"><?php echo $m->message?></td>

                            <td class="">
                                <?php echo $m->address?>
                                <BR/><?php echo $m->io?>
                            </td>
                            <td class="time"><?php echo $m->mdate?> <?php echo $m->mtime?></td>
                        </tr>
                    <!--  endif;?> -->
                    <?php
                    endforeach
                ?>
            </table>
        </div>

    </div><!-- /Right Side mail bar -->

i am using checkall box for check all and deleteing the content. manual selecting and deleting works fine but dont have idea for check all all the value after checking in checkall and delete those item. anybody have idea? please reply

and the jquery file custom.s is:

$('document').ready(function(){
var selectedMessages=[];    

$('.mail-right-box .mail-options-nav .input-group .input-group-addon input').click(function(){
        //alert('active');

        $('.mail-right-box .mails table tr td i').addClass('fa-square-o');
        $('.mail-right-box .mails table tr td i.fa-square-o').removeClass('active');
        //$(this).prop('checked', $(this).prop("true"));
        //$(this).addClass('test');
   /* if (this.checked) {

    }*/

});$('.mail-right-box .mails table tr td i').click(function(){
    $(this).toggleClass('active');      
}); 

$('.mail-right-box .mails table tr td i.fa-square-o').click(function(){
    $(this).toggleClass('fa-square-o');
    $(this).parent().parent().toggleClass('active');
    var active=$(this).parent().parent().hasClass('active');
    var id = $(this).attr('data-id');
    if(active){         
        var i = selectedMessages.indexOf(id);
        if(i==-1)
            selectedMessages.push(id);      
    }
    else{       
        var i = selectedMessages.indexOf(id);
        selectedMessages.splice(i,1);
    }
});

    $('#deleteButton').click(function(e){
    var list='';
    for(var i=0;i<selectedMessages.length;i++){
        list=list+selectedMessages[i];  
        var $tr = $('tr[data-id="'+selectedMessages[i]+'"]');
        $tr.remove();
    }
    $.ajax({
        url: 'test/delete.php',
        type: 'POST',
         data: {"points" : JSON.stringify(selectedMessages)},
        success: function(result) {
            bootbox.alert(result);                                              
        }
    });
});

mainly check-all code is inside

$('.mail-right-box .mail-options-nav .input-group .input-group-addon input').click(function(){ code.

please help me




How to implement the filter through checkbox's(php, ajax)

How to implement a filter that will show only those blocks that have relevant information, while all others hide? There is a table "Areas", "Street", and the main table "Hotels". In the table "Hotels" has columns "Region", "Street". They record the name of the area or street at, and not give id from the tables. For example, there is an area "Region12"(made in the form of a checkbox), and when we click on this box, find the block with the information in the database the value of the area "Region12" and others will disappear. I note that in the filter you can choose many values: for Example, the area "Region12", you can select a street "Street12", "Street13" and will display hotels in the area. In General, multi-checkboxes. Maybe there is some other option? Please help.

  <form action="index.php" method="post">
    <div id="filter_c">
        <div class="Region">
          <span>Region</span>
              <div class="filter_l"> 
                <?php foreach ($region as $id => $region): ?>
                    <div class="kbox">
                    <input type="checkbox" id="region_<?=$id;?>" value="<?=$id;?>" name="region[]" />
                      <label for="region_<?=$id;?>">
                        <span class="filter_name"><?=$region['region'];?></span>
                      </label>
                    </div>
                <?php endforeach; ?>
              </div>
        </div>
        <div class="street">
          <span>Street</span>
              <div class="filter_l"> 
                <?php foreach ($street as $id => $street): ?>
                    <div class="kbox">
                    <input type="checkbox" id="street_<?=$id;?>" value="<?=$id;?>" name="street[]" />
                      <label for="street_<?=$id;?>">
                        <span class="filter_name"><?=$street['street'];?></span>
                      </label>
                    </div>
                <?php endforeach; ?>
              </div>            
        </div>             
      </div>
  </form> 

Block with information about Hotels

<div class="desc">
  <h2><?=$hotel['name']?></h2>
   <p>Region: <?=$hotel['region']?></p>
   <p>Street: <span><?=$hotel['street']?></span></p>
</div>



Why does Flash Builder 4.7 not allow code hinting for components like CheckBox?

<?xml version="1.0" encoding="utf-8"?>

<s:WindowedApplication xmlns:fx="http://ift.tt/rYUnH9" 
                   xmlns:s="library://ns.adobe.com/flex/spark" 
                   initialize="init()"
                   xmlns:mx="library://ns.adobe.com/flex/mx">
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>

    <s:VGroup id="content">
        <s:VGroup id="sizes">
            <!-- I added the CheckBox, but code hints are absent-->
            <s:CheckBox width="100" label="Employee?"/> 
        </s:VGroup>
    </s:VGroup>

</s:WindowedApplication>

The only way you know the CheckBox exists is by running the document. No indication that it's even available.




how display check box based on another chckbox value using angularjs?

i have added my code.i am new to this technology pls any one help me out.i have two different checkbox list 1st one is Select Stores 2nd one is Select your device Company name .baesd on first checkbox checked value 2nd(Select your device Company name) checkbox list should come achievements: achievement :Based on first check box list(Select Stores) values 2nd checkbox(Select your device Company name) list should come

Example: if i select Sai Stores in Select Stores list .Select your device Company name list show should show only Sai Stores

Example2 : if i select Sai Stores,Sri Ram Stores in Select Stores list .Select your device Company name list show should show Sai Stores and Sri Ram Stores

example3 :

if nothing is select in that Select Stores list . Select your device Company name list should be hide or not visible

example 4:now i have already selected Sai Stores in Select Stores list.Select your device Company name list should show only Sai Stores .here instead of that its showing both in Select your device Company name list

if matched then only second list of checkbox should show other wise it should be hidden http://ift.tt/1MXlq6m

 var app = angular.module("myApp", []);
    app.controller("Test1Controller", function($scope) {
    var serverData = ["Sai Stores", "Sri Ram Shop", "Ragava Stores","Baba DHl Shop"];
    $scope.items = [];
        var selectedStore = 'Sai Stores';
        $scope.itemChecked = false;
                for (var i = 0; i < serverData.length; i++) {
                    var modal = {
                        name: serverData[i],
                        selected: false

                    };
                  if (selectedStore.indexOf(serverData[i]) >= 0 ) {
                        modal.selected = true;

                    }

                    $scope.items.push(modal);
                   
                }

        $scope.itemsChecked = function() {
            $scope.itemChecked = false;
            for (var i = 0; i < $scope.items.length; i++) {
                if ($scope.items[i].selected) {
                    $scope.itemChecked = true;
                }
            }
        }
//-----------------------------------------------------------------------------------------------------
$scope.stores = [{

        id: "1",
        storeid: "86754634",
        storename: "Sai Stores",
                servicedevice:"Htc"
        
    }, {
         id: "2",
        storeid: "3746579",
        storename: "Sri Ram Stores",
                servicedevice:"Samsung"
    }

    ]
//-----------------------------------------------------------------------------------------------------
        $scope.check = function() {
            var checkedItems = [];
            for (var i = 0; i < $scope.items.length; i++) {
                if ($scope.items[i].selected) {
                    checkedItems.push($scope.items[i].name);
                }
            }
            console.log(checkedItems);
        }
                $scope.check1 = function() {
            var checkedItems1 = [];
            for (var i = 0; i < $scope.stores.length; i++) {
                if ($scope.stores[i].selected) {
                    checkedItems1.push($scope.stores[i].servicedevice);
                }
            }
            console.log(checkedItems1);
        }
    });
<script src="http://ift.tt/1bdM3QL"></script>
<div ng-app="myApp">
    <form name="projectForm">
        <div ng-controller="Test1Controller">
             <label>Select Stores</label>
            <div ng-repeat="item in items">
                <input type="checkbox" ng-model="item.selected" ng-change="itemsChecked()" required="" />{{item.name}}</div><br><br><br>
            <label>Select your device Company name</label>
                         <div ng-repeat="store in stores">
                <input type="checkbox" ng-model="store.selected"  required="" />{{store.storename}}</div>
                                <div class="form-error" ng-messages="projectForm.booktime.$error">
                <div class="form-error" ng-message="required" ng-show="!itemChecked">* Mandatory</div>
            </div>
            <input type="button" name="submit" value="submit" ng-disabled="!itemChecked" ng-click="check();check1" />
        </div>
    </form>



Ubercart Attribute. Limit number of checkboxes that can be ticked

Drupal 7 Ubercart 7.x-3.8 I have a product in Ubercart. It is a box that can contain 6 bars of soap. I have set up an attribute with check boxes that shows 10 types of soap and I want to be able to limit the user to selecting 6 of those check boxes. Is this possible?




Call different file depending on whether checkbox is checked

Javascript newbie here, in need of help and hints. I'm currently calling my audio files this way:

    <div class="playFeatured">
        <audio id="playA" preload='none'>
           <source src='audio/RM-5.1.mp3' type='audio/mpeg' />
           <source src='audio/RM-5.1.ogg' type='audio/ogg' />
        </audio></div>

When the checkbox (#swingBox) is checked, I want to call the audio file from the directory 'audio/swing/*') instead. Here's my current code:

    var swingBox = document.getElementById('swingBox');
    var straightRhythm = $('#playA').find('audio').attr("src");
    $(document).ready(function() {
    if $('#swingBox').prop('checked', true){ 
        $(straightRhythm.slice(0,6) + "swing/" + straight.slice(6););};
    if $('#swingBox').prop('checked', false){
        $(straightRhythm);
    };
    }

Can anyone point me in the right direction? Thanks so much!




How to show the item that you check when comeback in a DialogFragment

I have a DialogFragment that show me the days of the week and a checkbox. My question is simple (but I can't do it) How can I save my selections to when I open again the DialogFragment I can see the days that I enable the last time.

Because I can't do something like this mSelectedItems.add(which).setChecked(true).

Thanks in advance.

public class DayFragment extends DialogFragment  {

    protected String[] listitems = { "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday" };


    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
       final ArrayList mSelectedItems = new ArrayList();  // Where we track the selected items
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

        builder.setMultiChoiceItems(listitems, null, new DialogInterface.OnMultiChoiceClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int which, boolean isChecked) {
                        if (isChecked) {
                            // If the user checked the item, add it to the selected items
                            mSelectedItems.add(which);

                            if(listitems[which].equals("Monday")){
                                Toast.makeText(getActivity(), listitems[which], Toast.LENGTH_SHORT).show();
                            }


                        } else if (mSelectedItems.contains(which)) {
                            // Else, if the item is already in the array, remove it
                            mSelectedItems.remove(Integer.valueOf(which));
                            if(listitems[which].equals("Monday")){
                                Toast.makeText(getActivity(), "Unchecked " + listitems[which], Toast.LENGTH_SHORT).show();
                            }
                        }
                    }
                })
                .setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {

                    }
                });

        return builder.create();
    }




can we apply class to checkbox input instedad of container div in cakephp

Here the code for checkbox generation

//code
echo $this->Form->select('Model.field', $options, array(
                                'multiple' => 'checkbox','div'=>'col-md-9',
                                'class' => 'required'
                            ));


//output
<div class="required" aria-required="true">
    <input type="checkbox" id="FormData6783" value="83" name="data[Model][field][]">
<label for="FormData6783">Sr. Secondary</label>
</div>
<div class="required" aria-required="true">
    <input type="checkbox" id="FormData6783" value="83" name="data[Model][field][]">
<label for="FormData6783">Secondary</label>
</div>

it applies class to container div instead of input.. Is there any way to apply class to input ?




Getting checked checkboxes' name, access another view ect

I am extremely new to ASP.NET MVC/JavaScript and frankly I don't, yet, understand the concept but this is my problem. I am trying to make an online pizza order system. The current problem I am facing is checking which checkboxes is selected(the ingredients that the person wants on their pizza) and passing that to another view, which will present the user with a break-down of what they ordered and with prices ext. What I have is a couple of checkboxes:

<div style="display: inline; font-family:Arial; font-size: 16px; color: black; background: rgba(255,255,255,0.5)"> <br />
        <input type="checkbox" name="Cheese" value="Cheese" />Cheese(R2.00) <br />
        <input type="checkbox" name="Capers" value="Capers" />Capers(R3.00) <br />
        <input type="checkbox" name="Banana" value="Banana" />Banana(R2.00) <br />
        <input type="checkbox" name="Avocado" value="Avocado" />Avocado(R4.00) <br />
        <input type="checkbox" name="Chicken" value="Chicken" />Chicken(R5.00) <br />
        <input type="checkbox" name="Anchovies" value="Anchovies" />Anchovies(R5.00) <br />
        <input type="checkbox" name="Sausage" value="Sausage" />Sausage(R5.00) <br />
        <input type="checkbox" name="Mince" value="Mince" />Mince(R6.00) <br />
        <input type="checkbox" name="Pepperoni" value="Pepperoni" />Pepperoni(R5.00) <br />
        <input type="checkbox" name="Spinach" value="Spinach" />Spinach(R4.00) <br />
        <input type="checkbox" name="Fresh Chilis" value="Fresh Chilis" />Fresh Chilis(R8.00) <br />
        <input type="checkbox" name="Green Peppers" value="Green Peppers" />Green Peppers(5.00) <br />
        <input type="checkbox" name="Bacon" value="Bacon" />Bacon(R6.00)<br />
        <input type="checkbox" name="Pineapple" value="Pineapple" />Pineapple(R3.00) <br />
        <input type="checkbox" name="Ham" value="Ham" />Ham(R2.00) <br />
        <input type="checkbox" name="Olives" value="Olives" />Olives(R9.00) <br />
        <input type="checkbox" name="Onions" value="Onions" />Onions(R3.00)
    </div> 

I came up with this piece of code, for the above mentioned problem.

@using (Html.BeginForm("Final", "Home"))
    {
            //I also tried saving to a list but didn't know how to access it from another view
            List<string> ingredientsChecked = new List<string>();
            <script>
            $('#checkBox input:checkbox').addClass('input_hidden');
            $('#checkBox checkbox').click(function () {
                var elementC = document.getElementsByName(this.name);
                for (var x = 0; x < elementC.length; x++)
                {
                    if (elementC[x].checked == true)
                    {
                        elementC[x].value;
                    }
                }
                var connection = new ActiveXObject("ADODB.Connection");
                var connectionstring = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\xxxxxxxxxx\ThePizzatorium\ThePizzatorium\App_Data\ThePizzatoriumDataBase.mdf;Integrated Security=True;Connect Timeout=30";
                connection.Open(connectionstring);
                var rs = new ActiveXObject("ADODB.Recordset");
                rs.Open("SELECT * FROM table", connection);
                rs.MoveFirst
                while(!rs.eof)
                {
                    document.write(rs.fields(1));
                    rs.movenext;
                }
                rs.close;
                connection.close;
            });
        </script>
        <input type="submit" value="Order Pizza" class="btn-primary" />
    }

But it doesn't work. Is there a better way than checking which checkbox is checked; writing the value to a sql database, thus reading the checked checkboxes from the other view via the sql database? Maybe saving it in a Session? If so, how would I do that? Any and all help will be appreciated!




mercredi 28 octobre 2015

Android : ImageView with checkbox in grid-view

I am trying to delete images with Checkbook.

I have done to delete the selected multiple images which is checked from grid-view on button click event. But the check-boxes are appearing as they are in the grid-view .

How can I remove the check-boxes also with images?

Thanks in advanced.

Here is my check-box code in getView() method in Android

 class GridView_Adapter extends BaseAdapter {

        private LayoutInflater mInflater;
        SparseBooleanArray mSparseBooleanArray;
        public GridView_Adapter() {
            mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            mSparseBooleanArray = new SparseBooleanArray();
        }

        public ArrayList<String> getCheckedItems() {
            ArrayList<String> mTempArry = new ArrayList<String>();

            for(int i=0;i<fileName.size();i++) {
                if(mSparseBooleanArray.get(i)) {
                    mTempArry.add(fileName.get(i));
                }}
            return mTempArry;
        }

        public int getCount() {
            return fileName.size();
        }

        public Object getItem(int position) {
            return position;
        }

        public long getItemId(int position) {
            return position;
        }

        @Override
        public View getView(final int position, View convertView, ViewGroup parent)
        {
           ViewHolder holder;
            if (convertView == null)
            {
                holder = new ViewHolder();
                convertView = mInflater.inflate(R.layout.add_post_grid_item_layout, null);
                holder.image = (ImageView) convertView.findViewById(R.id.image);
                holder.checkbox = (CheckBox) convertView.findViewById(R.id.itemCheckBox);
                convertView.setTag(holder);
            }
            else
            {
                holder = (ViewHolder) convertView.getTag();
            }

            Bitmap myBitmap = BitmapFactory.decodeFile(fileName.get(position));
            holder.image.setImageBitmap(myBitmap);
            final int pos = position;

            holder.checkbox.setId(position);
            holder.checkbox.setTag(position);
            holder.checkbox.setChecked(mSparseBooleanArray.get(position));
            holder.checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {

                 public void onCheckedChanged(CompoundButton buttonView, boolean isChecked)
                 {
                     mSparseBooleanArray.put((Integer) buttonView.getTag(), isChecked);
                     int pos = (Integer) buttonView.getTag();
                     if (!buttonView.isChecked())
                     {
                         picsName.remove((String) fileName.get(pos));
                     }
                     else if(buttonView.isChecked())
                     {
                         if (!picsName.contains((String) fileName.get(pos)))
                         {
                             picsName.add((String) fileName.get(pos));
                         }
                     }
                     notifyDataSetChanged();
                 }
             });

            return convertView;
        }

               class ViewHolder
        {
            ImageView image;
            CheckBox checkbox;
            int id;
        }
    }




display data only on selecting a checkbox

i have a check box, and want that when it is selected/checked, values from another file (i.e c_datetime.php) should get loaded, for this i have used ajax, when i select/check the checkbox the values are getting loaded properly but when i uncheck it the loader gets loaded again and the ajax displays the data again, whereas the proper way should have been that when the checkbox is selected the values should get loaded and when its unselected the values should disappear, can anyone please tell why its not working the way it should

<script>
$(document).ready(function(){
   $('#drive').change(function(){

        var catid = $('#drive').val();
        console.log($('#drive'))
        if(catid != 0)

        {
            LodingAnimate();
            $.ajax({
                type:'post',
                url:'c_datetime.php',
                data:{id:catid},
                cache:false,
                success: function(returndata){
                    $('#datetime').html(returndata);
                console.log(returndata)
                }
            });

             function LodingAnimate() 
                {
                    $("#datetime").html('<img src="img/ajax-loader.gif" height="40" width="40"/>');
                } 
        }
    }
    )
}) 

</script>   


<div id="datetime"> </div>
<input type="checkbox" name ="chk" id="drive" value="Drive" >Drive




checkbox in google visualization table

Please refer to the following link: http://ift.tt/1SayIRq

I am using google visualization table, and making a tree table like above. Some column in child row, I attached html checkbox.

I question I am facing is that, if I click the checkbox, it is never checked. This is because in the table listener, every time a select event is triggered, it will redraw the table.

I look at the google visualization table API, and find this:

Note that the table chart only fires row selection events; however, the code is generic, and can be used for row, column, and cell selection events.

This means that if I click a column in row, I can never know which column I actually clicked? So I can not get the checkbox by id, and using javascript to make it checked? That sucks...




Using jQuery to add class to containing li when a checkbox inside is clicked

Objective

Highlight (by adding a background-color to) the "row" <li> if a (nested) checkbox inside that row is clicked.

Background

In this feature I am working on the interface for a file management system. When a user clicks the checkbox they can then delete all the files checked. to give them visual feedback, i want all of their selected files to have a background color. This will be done by clicking a checkbox, then i want the <li> to be colored.

Current state

I found various helpful answers on stackoverflow but have a gap in knowledge and trying to fill that in. Most answers use the parent element. But that only helps me by coloring that specific parent that holds the checkbox.

enter image description here

Code

I have this demo on codepen

jQuery

$("#this-list :checkbox").on('click', function(){
    $(this).parent().toggleClass("checked");
});

CSS

.checked {
    background: red;
}

HTML

<div class="container">
    <ul id="this-list">

        <li>
            <div class="row">
                <div class="col-md-2">
                    <input type="checkbox" />
                    song.mp3
                </div>
                <div class="col-md-2">
                    2011
                </div>
                <div class="col-md-2">
                    1 gb
                </div>
                <div class="col-md-2">
                    2 min
                </div>
            </div>
        </li>

    <!-- More <li>s -->
    </ul>
</div>




AngularJS: Binding Checkbox to Object in MongoDB Collection

I am still fairly new to NodeJS, MongoDB and AngularJS.

I have a collection called 'Strategy' where each document defines a trading Strategy involving multiple bitcoin exchanges.

I've got the following section of schema defined for my 'Strategy' collection:

    ...
    primaryExchanges: [{
        exchange: {
            type: Schema.ObjectId,
            ref: 'Exchange'
        }, 
        ratio: {
            type: Number,
            default: 0,
        }
    }],
    ...
    totalCoins: {
        type: Number,
        default: 100,
    },
    ...

exchange: a reference to an object in the Exchanges collection, ratio: how much of the strategy's totalCoins should be spent on that exchange.

Each exchange has a seperate set of 'instruments' that they support trading on, and I'd like to represent which instruments the user wants this particular strategy to trade on.

Ideally, I'd like get a document back for the 'Strategy' collection that looks something like this:

    totalCoins: 100,
    primaryExchanges: [
        {
            exchange: idForExchange1,
            ratio: 0.6,
            instruments: [
                {name: "instrument a", enabled: true},
                {name: "instrument b", enabled: false}
            ]
        },
        {
            exchange: idForExchange2,
            ratio: 0.4,
            instruments: [
                {name: "instrument c", enabled: true},
                {name: "instrument d", enabled: true},
                ...
            ]
        }
    ]

So I modified my schema to look like the following:

    ...
    primaryExchanges: [{
        exchange: {
            type: Schema.ObjectId,
            ref: 'Exchange'
        }, 
        ratio: {
            type: Number,
            default: 0,
        },
        instruments: [{
            name: {
                type: String,
                default: ''
            },
            enabled: {
                type: Boolean,
                default: false
            }
        }]
    }],
    ...

In my view, I would like to be able to display which instruments on the exchange are enabled/disabled for trading using a set of checkboxes.

    Exchange1:
        Ratio: 0.6
        Use Instruments:
            [x] instrument a    [] instrument b

    Exchange2:
        Ratio: 0.4
        Use Instruments:
            [x] instrument c    [x] instrument d

When I go to save the model using my edit view, the document in the database isn't get updated, I believe it's the way I am using data-ng-model to bind to the instruments.

In my view I have an ng-repeat to iterate over each of the primaryExchange elements, I am using something like this to bind to the checkboxes:

    <div class="columns col-lg-3" data-ng-repeat="instrument in exchange.instruments">
        <label><input data-ng-model="strategy.primaryExchanges[$index].instruments[instrument]" type="checkbox" value="{{instrument}}">{{instrument}}</label>
    </div>

In this view, each "instrument" in "exchange.instruments" is simply a string with the instrument's name:

    // exchange.instruments
    ['instrument a', 'instrument b']

How could I modify my data-ng-model directives so that each checkbox is bound to an instrument belonging to the current primaryExchange in my list?

Thanks




Why Kivy checkbox active event not work?

I can not find which is the main event for the checkbox in the kv file. I tried on_checkbox_active but raise an error. I tried on_active but does nothing (and do not raise any error) on_release, on_press but obviously give me an error.

this is my basic test code line: on_active: print("hello")

What is the event that run when click on a checkbox?

thank you guys




FuelUX - Dynamically uncheck a checkbox upon removal of Pillbox

I have implemented a Pillbox via FuelUX into one of my pages. We are using the pillbox to help give a better visual to our filtering system. A user will check a checkbox and then a pill will append. The issue is that after pressing "x" on the pill and closing it, we would like for the checkbox to uncheck as well.

                <div class="fuelux">
                    <div class="pillbox col-sm-4 well well-lg" data-initialize="pillbox" id="myPillbox" style="min-height: 200px;">
                        <p class="text-center"><u><b>SELECTED FILTER OPTIONS</b></u></p>                           
                        <ul class="clearfix pill-group">

                        </ul>
                    </div>
                </div>

Here is the jquery

function addPillBox(obj) {

var response = $('label[for="' + obj.id + '"]').html();

if (document.getElementById(obj.id).checked) {

    $('#myPillbox').pillbox("addItems", [{ text: response, value: '', attr: {}, data: {} }]);
} else {
    $('#myPillbox').pillbox('removeByText', response);
}
}

    $('#myPillbox').click('removed.fu.pillbox', function (evt, obj) {
alert('hit');
$("#" + obj.id).attr('checked', false); // Unchecks it});




jQuery - Switch between background picture and background video using a checkbox

I was searching and searching everywhere, but I couldn't find anything that would help me out with my question, so I'm seeking for help here.

Initially, I'd like to have a background video playing on my website, but whenever a certain checkbox is ticked, switch to a picture. When it's unticked, it should play the video again.

I'm not sure if this is possible with jQuery and if it isn't, please advise me on what language is capable of this. If possible, I'd like to have another checkbox which when ticked, mutes music, again if possible.

Thank you very much in advance for answers. If you need any more information, just ask :)




Checkbox in html table data

For some reason my check boxes in a table aren't being displayed.

My code for the table:

<table>
<tr>
...
<td><input type="checkbox" name="vehicle" value="Bike" />Hi</td>
...
</tr>
</table>

However, all I see is the Hi being displayed but no check box.




# of Checked Boxes Doesn't Always "Keep Up"

I have a table with multiple header rows, something like this:

Row 1:   Month 1      Month 2    Month3 

Row 2:   Ct % Ttl     Ct % TTl   Ct % TTl

I want to give the user ability to select which fields they want to see, so if they only want to see Ct & Ttl, then the colspan of the first row needs to adjust. My code snippet below is "almost" working, the problem is, sometimes after a field is checked or unchecked, the new count is wrong -- it will stay on the "old count". So like above, the initial colspan is 3, a user unchecks one of the boxes, the colspan should go down to 2, but it will stay at 3. Then, the user can uncheck a second box, and the count will catch up and correctly show 1. Is my code missing something?

var options = [];

$(document).on('click', '.dropdown-menu a', function(event) {
  var $target = $(event.currentTarget),
    val = $target.attr('data-value'),
    column = 'table .' + val,
    $inp = $target.find('input'),
    idx;

  if ((idx = options.indexOf(val)) > -1) {
    options.splice(idx, 0);
    setTimeout(function() {
      $inp.prop('checked', true)
    }, 0);
  } else {
    options.push(val);
    setTimeout(function() {
      $inp.prop('checked', false)
    }, 0);
  }

  $(column).toggle();

  var ct = $("#ddColFilter input:checked").length;

  $("#tb").val(ct);

  $(".topRow").attr("colspan", parseInt(ct));

  $(event.target).blur();

  return false;
});
<script src="http://ift.tt/1oMJErh"></script>
<div class="col-md-1 button-group" style="padding-top: 12px; padding-bottom: 1px; margin-bottom: 1px;">
  <button type="button" class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><span class="glyphicon glyphicon-cog"></span>&nbsp;Filter Columns&nbsp;<span class="caret"></span>
  </button>
  <ul id="ddColFilter" class="dropdown-menu">
    <li>
      <a href="#" class="small underlineText_No" data-value="attRate" tabindex="-1">
        <input type="checkbox" checked="checked" />&nbsp;Attendance Rate</a>
    </li>
    <li>
      <a href="#" class="small underlineText_No" data-value="enrDays" tabindex="-1">
        <input type="checkbox" checked="checked" />&nbsp;Ttl Enrollment Days</a>
    </li>
    <li>
      <a href="#" class="small underlineText_No" data-value="msdDays" tabindex="-1">
        <input type="checkbox" checked="checked" />&nbsp;Ttl Missed Days</a>
    </li>
    <li>
      <a href="#" class="small underlineText_No" data-value="lstRev" tabindex="-1">
        <input type="checkbox" checked="checked" />&nbsp;Lost Revenue</a>
    </li>
    <li>
      <a href="#" class="small underlineText_No" data-value="lstHrs" onclick="" tabindex="-1">
        <input type="checkbox" checked="checked" />&nbsp;Instrl Hrs Lost</a>
    </li>
  </ul>
</div>

<div>
  <input id="tb" type="text" value="5" />
</div>



jQuery Checkbox Not Refreshing On Page Load

Using jQuery 1.9, I'm writing a WebForm that retrieves data on page load an alters WebFields based on results. One of the fields is a checkbox.

<input id="chkFollowUp" type="checkbox" class="form-control"/>

I am trying to change the value on page load. The back end says the value has been altered, but the UI remains unchecked.

<script type="text/javascript">
    $(document).ready(function () {
        alert($('#chkFollowUp').prop('checked'));    // return false
        $('#chkFollowUp').prop('checked', true);
        alert($('#chkFollowUp').prop('checked'));    // return true, but UI unchanged
    })
</script>

Do I need to refresh the UI to display the new value? Any guidance would be appreciated. Thank you.




how to create Dynamic check-box list with 3 options in C#

CheckBox list for languages skills

I need to create check-box list dynamically populated from database. I have no problem with creating this with the single option but with 3 - kind of puzzle me. Currently I have following code which create single colum of checkboxes with Language name:

public void CreateCheckBox(DataSet DSDataForCheckBox, string pLangGrp)
    {
        CheckBoxList chkList = new CheckBoxList();
        chkList.ID = "LanguageList";
        chkList.AutoPostBack = true;
        chkList.DataSource = DSDataForCheckBox;
        chkList.DataTextField = "LangName";
        chkList.DataValueField = "LangID";
        chkList.DataBind();

        Panel pLang = new Panel();

        if (pLangGrp != "")
        {
            pLang.GroupingText = pLangGrp;

        }
        else
        {
            pLang.GroupingText = "Non Assigned Group";

        }
        pLang.Controls.Add(chkList);
        this.Form.Controls.Add(pLang);

    }

Need your experts help. Thanks

 PS: we are on NET 3.5, so many options from 4.0 is not available for me.



conflict in triggering span click and watch events sequences in text box and check box models in Angularjs application

I am making watch on Text box and Check box models to call my custom defined function. As I don't want to call my custom function inside the watch during initial loading of data, inside watch I am depending on a needwatch flag when to call my custom defined function. For this purpose I have kept both check box and Text boxes inside span element and when span is clicked I am making that needWatch flag to be true so that, the custom function will be called when that particular model is changed, so that this custom function won't be called during initial loading of data. This logic working fine for Text box, (even for select drop down) but failing on check box.

The reason is, for Text box, ALWAYS, its span ng-click event is triggering first and then the watch function on the Text box model is firing up next. Where as for Check box, randomly, its watch function is triggering first and then its span ng-click event is firing up next and vice versa.

I want for check box also, ALWAYS, its span ng-click event to be triggered first instead its model watch function. Is it possible?

please find the plunker and try to change text box and check box values.




Changing a XAML CheckBox to Add or Remove SymbolIcon

I have been looking for a solution for this a while. But without result.

How can I make a normal XAML CheckBox round with the Add SymbolIcon and when it is Checked the Remove SymbolIcon is shown?




AngulerJS set check box checked default with checklist-model

I've check boxes inside the ng-repeat loop and I'm using checklist-model to get the checked value. However I need to set those check boxes checked in by default. I've used ng-checked="true". however it shows check box is checked but value is empty when submit it.
code is:

<tr data-ng-repeat="line_items in orderItems">
<td align="center" data-ng-if="line_items.id">
    <div class="vd_checkbox checkbox-success">
          <input type="checkbox" id="checkbox-{{$index}}"
              checklist-model="comp.orderItemSelect"
              checklist-value="line_items.id"  ng-checked="true"/>
          <label for="checkbox-{{$index}}">&nbsp;</label>
     </div>
</td>
<tr>

ng-checked show check box is checked but checklist-model not get it as selected. How do I default checked checkbox with checklist-model ?




To increase size of Radio Buttons and Checkboxes in Mozilla Browser

I have used some Checkboxes and Radio bUttons in my webpage. On zooming size of Checkboxes, Radio bUttons and other elements is increasing in Chrome and IE browser. But in Mozilla browser only text size is getting increased on zooming. Is there any Moz property to increase the size of Checkboxes and Radio bUttons on zooming in Mozilla.




mardi 27 octobre 2015

ng-checked event for checkbox in AngularJS

I am trying to use ng-checked for checkbox under ng-repeat.

<div class="listing" ng-repeat="item in list>
<input type="checkbox" class="favor" ng-checked='::isFavorite(item)' ng-click='setFavorite(item)'/>
</div>

There is one method, which I am calling on ng-checked event. But, if there are 50 checkboxes in the list (i.e. 50 items in ng-repeat), then each time the page is drawn, the same method gets called twice an item. Any help would be really appreciable.!!




jQuery - change input value to checkbox and checked

I wrote a schedule function, you can type your name and check days, it will dynamically add to the rule table. And I also added an button to change your input values and save. But now, I can only edit "Name" values, is it possible to change days to checkbox, if I click edit button? Click edit button and days change to the checkbox(Sun Mon Tue Wed Thu Fri Sat) and checked if I've already chosen it, It's better to click another days and save.

jsfiddle http://ift.tt/1N6DYoY

html part:

<div>
    <label>Type Your Name</label>
    <div>
        <input id="name" type="text" maxlength="20">
    </div>
</div>
<div>
    <label></label>
    <div>
        <table id="Date">
            <tbody>
                <tr>
                    <th>Sun</th>
                    <th>Mon</th>
                    <th>Tue</th>
                    <th>Wed</th>
                    <th>Thu</th>
                    <th>Fri</th>
                    <th>Sat</th>
                </tr>
                <tr>
                    <td><input name="Sunday" type="checkbox" value="0"></td>
                    <td><input name="Monday" type="checkbox" value="1"></td>
                    <td><input name="Tuesday" type="checkbox" value="2"></td>
                    <td><input name="Wednesday" type="checkbox" value="3"></td>
                    <td><input name="Thursday" type="checkbox" value="4"></td>
                    <td><input name="Friday" type="checkbox" value="5"></td>
                    <td><input name="Saturday" type="checkbox" value="6"></td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<div>
    <button type="button" id="add">Add</button>
</div>
<br>
<div>
<table id="form">
    <tbody>
        <tr>
            <th>Rules</th>
        </tr>
    </tbody>
</table>

jQuery part:

var rowNum = 0;
var dateVals = [];

$('#add').click(function() {
    var Name = $('#name').val();
    var dateVals = [];
    $('#Date :checked').each(function () {
        dateVals.push($(this).attr('name'));
    });
    rowNum ++;

    var row = '<tr id="row' + rowNum + '">'
            + '<td class="rowName">' + Name + '</td>&nbsp;&nbsp;&nbsp;&nbsp;'
            + '<td class="rowDate">' + dateVals + '</td>'
            + '<td><div><button type="button" class="edit">Edit</button></div></td>'
            + '</tr>';

    $(row).insertAfter($("#form > tbody > tr:last"));
    $('#name').val('');
    $('#Date :checked').removeAttr('checked');
});

$('#form').on('click','.edit',function() {
    var $row = $(this).closest('tr');
    $('.rowName',$row).each(function() {
        if ($(this).find('input').length) {
            $(this).text($(this).find('input').val());
        }
        else {
            var t = $(this).text();
            $(this).html($('<input maxlength="20" />',{'value' : t}).val(t));
        }
    });

    $(this).text(function(_, val){
        return val == 'Save' ? 'Edit' : 'Save';
    });
});




How to dynamically link a CheckBox to enable a TextBox in C# (WPF)?

I am a total noob so please bear with me. I have a row in a grid with 5 textboxes, 2 of which are enabled by checkboxes. I am trying to dynamically add additional rows to the grid when a button is clicked. The eventhandler I added will only enable the textbox in the first row, but not in the current row (2nd). There is another eventhandler which handles the box in the first row, this is a new one. (BTW I only have part of the second row coded). Not sure if I should try making a template for the checkbox, and then use binding to the textbox? And if so, the instructions I've read on connecting the binding are vague and confusing. Or can I do the binding directly? Or ????

 public partial class Window2 : Window
{
    int currentColumn = 0;
    int currentRow = 1;
    int timesCalled = 1;
    public Window2()
    {
        InitializeComponent();
    }               
    private void AddLevelButton_Click(object sender, RoutedEventArgs e)
    {
        string level = this.Level.Content.ToString();  //label for the row
        string[] splitLevel = level.Split(' ');
        int levelNum = int.Parse(splitLevel[1]);
        levelNum = timesCalled + 1;            
        int nextRow = currentRow + 1;           
        int nextColumn = currentColumn + 1;
        Label levelLabel = new Label();
        levelLabel.Content = "Level " + levelNum.ToString();          
        Grid.SetRow(levelLabel, nextRow);
        Grid.SetColumn(levelLabel, currentColumn);
        FlowGrid.Children.Add(levelLabel);
        currentColumn++;
        CheckBox antesBox = new CheckBox();   //the checkbox to enable the
        antesBox.Name = "AntesBox";           //textbox which follows
        antesBox.VerticalAlignment = VerticalAlignment.Bottom;
        antesBox.HorizontalAlignment = HorizontalAlignment.Right;
        antesBox.FontSize = 16;
        antesBox.Width = 20;
        antesBox.Height = 20;
        antesBox.Checked += AntesBox_Checked1;      //eventhandler
        Grid.SetRow(antesBox, nextRow);
        Grid.SetColumn(antesBox, currentColumn);
        FlowGrid.Children.Add(antesBox);
        nextColumn = ++currentColumn;
        TextBox enterAntes = new TextBox();      //the textbox to be enabled
        enterAntes.Name = "EnterAntes";
        enterAntes.Margin = new Thickness(5, 0, 5, 0);
        enterAntes.FontSize = 16;
        enterAntes.FontFamily = new FontFamily("Verdana");
        enterAntes.IsEnabled = false;       
        enterAntes.KeyDown += EnterAntes_KeyDown1;    //tested; this works
        Grid.SetRow(EnterAntes, nextRow);
        Grid.SetColumn(EnterAntes, nextColumn);
        FlowGrid.Children.Add(EnterAntes);
        nextColumn = ++currentColumn;

    }

    private void enterAntes_KeyDown1(object sender, KeyEventArgs e)
    {
        int key = (int)e.Key;
        e.Handled = !(key >= 34 && key <= 43 ||
         key >= 74 && key <= 83 || key == 2); 
    }

    private void AntesBox_Checked1(object sender, RoutedEventArgs e)
    {
        EnterAntes.IsEnabled = true;
    }




Javascript: Calculate real time form input which also changes with checkboxes

I have a form where I need to calculate GST (Goods Services Tax) real time inline on the form

(GST = Price/11)

which I have managed to do with the following script.
But it also needs to be changed if I click on

checkbox (exc. GST) means GST = 10% of the price

and

checkbox (GST Free) means GST = 0


HTML Form:

<form class="form-horizontal" name="newItemForm" id="newItemForm" action="" method="post" enctype="multipart/form-data">
              <div class="form-group">
                <input type="text" class="form-control" name="itemName" id="itemName" style="text-transform:capitalize" placeholder="Enter Item Name" autocomplete="off">
              </div>
              <div class="form-group">
                <input type="text" class="form-control" name="price" id="price" placeholder="Item Price" onkeyup="calculateGST()" autocomplete="off"> 
              </div>
              <div>
                <label class="checkbox-inlibe">
                  <input type="checkbox" Value="incGST"> Exc. GST
                </label>
                <label class="checkbox-inlibe">
                  <input type="checkbox" Value="FRE"> GST Free
                </label>
              </div>
              <div class="form-group">
                <input type="text" class="form-control calGST" name="gst" id="gst" placeholder="GST" autocomplete="off" disabled>
              </div>
              <div class="form-group">
                <input type="number" class="form-control" name="unitsPerCTN" id="unitsPerCTN" value="" placeholder="Units Per CRT" autocomplete="off">
              </div>
              <div class="form-group">
                <input type="text" class="form-control" name="supplier" id="supplier" style="text-transform:capitalize" placeholder="Supplier" autocomplete="off">
              </div>
              <button type="submit" name="submit" id="submit" class="btn btn-success">Submit</button>
              <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
            </form>

SCRIPT:

<script>
function calculateGST() {
    var priceStr =document.newItemForm.price.value;
    if (!priceStr)
        priceStr = '0';
    var price = parseFloat(priceStr);
    document.newItemForm.gst.value = price / 11;
}
</script>




Check Box DataBinding / MinWidth Problems

I am creating a UWP application and I want a simple check box, no text, for each entry in my ListView. If I add a checkbox control to my template for the listview, I get a big gap after the checkbox for the Content - event when the content is empty.

If I turn on multiselect in the listview so I get a nice checkbox for each row, I can't seem to figure out how to databind the check box for each row in the listview to the Selected property of my ViewModel.

Below is a picture of what I want the area of the check box to look like. This was generated using the SelectionMode="Multiple" on the listview. Remember - the problem with this approach is I can't seem to find a way to bind the check box to the Selected property of my ViewModel class. Image of using SelectionMode on ListView

Below is what it looks like if I remove the SeletionMode property and add a check box to my ItemTemplate. As you can see there is a huge gap between the check box and the area where the image will be due to the Checkbox control's minimum width of 120.

Image using ItemTemplate

Any suggestions would be greatly appreciated.




Hundreds of checkboxes change from True/False to Yes/No

I have a spreadsheet that is continuously being updated to track visitations to patients. I have 2 columns that I've used the below VBA code to enter multiple checkboxes into which are assigned to the cell into which they are located. However, I would like to add something that makes the value of the checkboxes either Yes or No when I click on them. There are over 600 of these in the spreadsheet, so I need something that will cover all of them at once instead of having to change each one separately. I would post a pic of the spreadsheet, but I can't yet since I'm a new user and don't have reputation points. Can anyone help?

Sub AddCheckBoxes()

Dim cb As CheckBox
Dim myRange As Range, cel As Range
Dim wks As Worksheet

Set wks = Sheets("Sheet1")

Set myRange = wks.Range("K2:K300, L2:L300")

For Each cel In myRange

Set cb = wks.CheckBoxes.Add(cel.Left, cel.Top, 30, 6)


With cb

    .Caption = ""
    .LinkedCell = cel.Address

End With

Next

End Sub

End Sub




Android custom checkbox (or ToggleButton) with numbers inside

I'm writing an app that will have 60 checkboxes, numbered 1-60. My goal is to achieve something like this:

Unchecked enter image description here

Is there a way to achieve this without having to draw 60 .png files with the number inside? Could I draw only the edges and add the numbers as a text property of the button?

I tried customizing a ToggleButton (got the idea from here)

<ToggleButton
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:button="@drawable/toggle_selector"
    android:background="@null"
    android:paddingLeft="10dp"
    android:layout_centerHorizontal="true"
    android:gravity="center"
    android:textOn="60"
    android:textOff="60" />

toogle_selector.xml

<selector xmlns:android="http://ift.tt/nIICcg">
    <item
        android:state_checked="true"
        android:drawable="@drawable/checked" />
    <item
        android:drawable="@drawable/not_checked" />
</selector>

but as a result, the text was placed at the right of the button. Is it possible to place the text on top of the image?




Laravel block member by checkbox

I am using Laravel 5.1

I have a client table. Client will create their own account and waiting for admin approval. Admin can activate, deactivate or even block them anytime. I have three links (I can change to button if needed) bottom of the table ACTIVE, DEACTIVATE & BLOCK. There is also checkbox in every row.

Now, I want select one or multiple clients and change the value of the status field of member table in database.

Here is code of my view:

<table border="1">
    <tr>
        <td></td>
        <td>Name</td>
        <td>Activity</td>
        <td>main Activity</td>
        <td>Legal Status</td>
        <td>SIREN Code</td>
        <td>Contact Firstname</td>
        <td>Contact Lastname</td>
        <td>Contact Email</td>
        <td>Contact Telephone</td>
        <td>Address</td>
        <td>Town</td>
        <td>Area</td>
        <td>Region</td>
        <td>Creation Date</td>
        <td>Offer Pack Name</td>
        <td>Login Password</td>
        <td>Status</td>
    </tr>
    @foreach($clients as $client)
    <tr>
        <td>{!! Form::checkbox('client[]',$client->id,null) !!}</td>
        <td>{{ $client->name }}</td>
        <td>{{ $client->activity }}</td>
        <td>{{ $client->main_activity }}</td>
        <td>{{ $client->status }}</td>
        <td>{{ $client->siren_code }}</td>
        <td>{{ $client->contact_firstname }}</td>
        <td>{{ $client->contact_lastname }}</td>
        <td>{{ $client->email }}</td>
        <td>{{ $client->contact_telephone }}</td>
        <td>{{ $client->address }}</td>
        <td>{{ $client->town }}</td>
        <td>{{ $client->area }}</td>
        <td>{{ $client->region }}</td>
        <td>{{ $client->creation_date }}</td>
        <td>{{ $client->offer_pack_name }}</td>
        <td>{{ $client->password }}</td>
        <td>{{ $client->status }}</td>
    </tr>
    @endforeach
</table>
<div class="col-md-10 text-center">
    <a href="{{ action('AdminController@blockClient') }}" class="btn btn-default">BLOCK</a>
    <a href="{{ action('AdminController@activateClient') }}" class="btn btn-default">ACTIVATE</a>
    <a href="{{ action('AdminController@deactivateClient') }}" class="btn btn-default">ACTIVATE</a>
</div>

My route is:

get('blockClient','AdminController@blockClient');
get('activateClient','AdminController@activateClient');
get('activateClient','AdminController@deactivateClient');