vendredi 30 septembre 2016

give css to checkbox

I am new to CSS.

I want to give CSS to checkbox just shown in the image.here is the image

i have tried but checkbox is appearing on the screen and when I select on of the category then it background would be yellow.

Thank You.

.radio_toggle {
  float:left;
}

.radio_toggle label {
  float:left;
  width:100px;
  overflow:auto;

}

.radio_toggle label span {
  text-align:center;
  font-size: 15px;
  padding:5px 0px;
  display:block;

}

.radio_toggle label input {
  position:absolute;
}

.radio_toggle .venue {
  background-color:#edf1f2;
  color: #58666e;
  min-height: 100% !important;
  border: thin #ced9db solid;
  border-top-left-radius: 3px;
  border-bottom-left-radius: 3px;

}
<div class="categories">
                                        <div class="radio_toggle">
                                            <label class="venue" style=""><input type="checkbox" name="toggle"><span>Category</span></label>
                                        </div>
                                    </div>

                                    <div class="categories">
                                        <div class="radio_toggle">
                                            <label class="venue" style=""><input type="checkbox" name="toggle"><span>Category</span></label>
                                        </div>
                                    </div>

                                    <div class="categories">
                                        <div class="radio_toggle">
                                            <label class="venue" style=""><input type="checkbox" name="toggle"><span>Category</span></label>
                                        </div>
                                    </div>



How To Make A Calendar In C#

I Want Make A Calendar For My WinForm And I Need This

  • 1) Each Of Days Have A CheckBox ( For Limited The Record Of That Day )
  • 2) For Example I Select September 20 To September 25 , I Want The Calendar Changed Color Of That Day's
  • 3) Make 2 Button's For Select All And Unselect ( For That Day's)



android checkbox show and hide

I have a checkbox in linearlayout6 when i click on the checkbox i want to show linearlayout7,linearlayout8,linearlayout9. otherwise i want to hide these 3 linearlayout(7,8,9).

checkbox

<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkbox1"
/>

XML

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.25"
        android:text="@string/string41" />

    <EditText
        android:id="@+id/txtTitle"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:ems="10"
        android:hint="@string/string41"/>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout2">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.25"
        android:text="@string/string42" />

    <EditText
        android:id="@+id/txtAuthor"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:ems="10"
        android:hint="@string/string42"/>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout3">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.25"
        android:text="@string/string43" />

    <EditText
        android:id="@+id/txtPublisher"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:ems="10"
        android:hint="@string/string43"/>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout4">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="0.25"
        android:text="@string/string44" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/txtIsbn"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:hint="@string/string44"/>
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout5">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="0.25"
        android:text="@string/string45" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText6"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:hint="@string/string45" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout6">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/checkbox1"
/>
    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:orientation="horizontal" >

        <TextView
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="center_vertical"
            android:layout_weight="0.25"
            android:text="@string/string46" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout7">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="0.25"
        android:text="@string/string47" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText7"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:hint="@string/string47" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout8">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="0.25"
        android:text="@string/string48" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText8"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:hint="@string/string48" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:id="@+id/screen4layout9">

    <TextView
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical"
        android:layout_weight="0.25"
        android:text="@string/string49" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:orientation="horizontal" >

        <EditText
            android:id="@+id/editText9"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:hint="@string/string49" />
    </LinearLayout>
</LinearLayout>
<LinearLayout
    android:layout_width="fill_parent"
    android:layout_height="81dp"
    android:orientation="horizontal"
    android:id="@+id/screen4layout10">

    <View
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.25" />

    <LinearLayout
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_weight="0.75"
        android:orientation="horizontal" >

        <Button
            android:id="@+id/btnSubmit"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:text="@string/save" />

        <Button
            android:id="@+id/btnCancel"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ems="5"
            android:text="Delete" />
        <Button
            android:id="@+id/btn_close_popup4"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:text="Close" />
    </LinearLayout>
</LinearLayout>




TiddlyWiki: Working with checkboxes and custom plugins

I am trying to write a custom plugin using the Classic version of TiddlyWiki. The plugin is supposed to react to checkboxes when clicked, but I can only get the following code to work properly when the page is saved and refreshed. I need to this work when the checkbox is clicked. Is there some kind of onclick/onchange event I can work with when writing the plugin? I do not have much experience when it comes to creating plugins in TiddlyWiki.

if (config.options.chkHideSidebar===undefined)
config.options.chkHideSidebar=false;

if (config.options.chkHideSidebar===false)
alert('false'); // altering CSS stylesheet when clicked
else if (config.options.chkHideSidebar===true)
alert('true'); // altering CSS stylesheet when clicked




Use row.add for datatable with checkboxes

I have the following code that I am using to populate and generate rows for a checkbox datatable:

    var array = [...];
    $datatable = $('#datatable-checkbox');

    // checkboxes
    $datatable.dataTable({
      'order': [[ 1, 'asc' ]],
      'columnDefs': [
        { orderable: false, targets: [0] }
      ]
    });

    for(int i in array) {
        var name = array[i][0];
        var message = array[i][1];
        var num = array[i][2]; 

        $datatable.DataTable().row.add([
            name,
            message,
            num
        ]).draw( false );
    }

However, the first data field in the row (name) seems to replace the checkboxes as if the rows were empty.

My question is, is there a way to add data to a row while ignoring the first column? Or to add checkboxes back to the first column?




Ruby on Rails: How to "un-do" timestamp if I uncheck a checkbox

I'm working on a list where a checkbox indicates completion of an item, and a completion_date is populated with the current date/time if the checkbox is checked. My method is:

def complete
  @task = Task.find(params[:id])
  if @task.complete == nil || @task.complete == false
    @task.update(complete: true)
    @task.update(completion_date: Date.today)
    redirect_to task_path
  else
    redirect_to task_path
  end

end

So if the box is checked, the date is filled. However, I want my users to be able to uncheck the checkbox, and therefore void the timestamp.

I'm a rails newbie. Any help greatly appreciated.




Checkbox selected list contains only those on the screen

I have a GridView containing a list of items with a checkbox and I use the code below to "page" table (Datatables js):

$(".gvdatatable").dataTable();

The problem occurs when I check which checkboxes are selected, because at this point is only listed those that are being displayed on the screen, that is, if I select two items from page 1 and select an item on page 2, the code only considers the checkbox selected on page 2. the interesting thing is that if I go back to page 1 checkbox is still selected. GridView code:

<asp:GridView ID="dataTables" CssClass="gvdatatable table table-striped table-bordered table-hover textTable" runat="server"
                                AutoPostBack="True"
                                OnRowDataBound="Grid_RowDataBound"
                                OnPreRender="dataTables_PreRender">

<Columns>

    <asp:TemplateField>
        <HeaderTemplate>
            <asp:CheckBox ID="CheckAll" runat="server" onclick="GridSelectAllColumn(this);"/>
        </HeaderTemplate>

        <ItemTemplate>
           <asp:CheckBox ID="CheckStatus" runat="server" CssClass="chk" />
        </ItemTemplate>
    </asp:TemplateField>

    <asp:BoundField DataField="NOME" HeaderText="NAME"/>
    <asp:BoundField DataField="CARDID" HeaderText="CARDID" />
    <asp:BoundField DataField="OLD" HeaderText="OLD" />

</Columns>

Code that retrieves the checkbox:

foreach (GridViewRow viewRow in dataTables.Rows)
{
    var t = viewRow.Cells[0].FindControl("CheckStatus") as CheckBox;

    if (t.Checked)
    {
        lista.Add(t);
    }
}




Checkbox databinding default value null

I am databinding a checkbox to a bindingsource, if i dont click the checkbox it will return a null value to my database.

This is the databinding code:

 checkGehuwd.DataBindings.Add("Checked", PersonenBindingSource, "gehuwd", true,
            DataSourceUpdateMode.OnPropertyChanged);

how do i return a default value of false?

Greetings Andy




Why are my checkboxes unchecking when changing Page? WPF C# .NET

So basically.. I added 2 new pages in a frame and when I press a button it changes frame..

But if I check a checkbox on the first page it wont be checked if I go to another page and then go back to the first one..

here is a more visual look http://ift.tt/2cHlhsB

Source code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace CheckboxesAndPages
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private void button_Click(object sender, RoutedEventArgs e)
        {
            main.Content = new SecondPage();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            main.Content = new thirdPage();
        }
    }
}

There is no source code for the 2 pages.




Using OR Operator For Null Values in IIF Statement

I've got a MS access form with optional criteria for running a query. The user will select a checkbox and enter a value then run the query based on the selected fields and inputs. The issue I have for one field in particular is the table stores NULL Values. The criteria for the query looks like this:

 IIf([Checkbox]=-1,[Data in Form],([Field]Like "*" Or [Field]Is Null))

If I use this code as criteria for the field in the query, it only works when a value is in the form and the checkbox is selected. If I use the code as an expression, it returns the NULL values when the checkbox is not selected but returns all the records when the checkbox is selected and a value is entered. if I use Like "*" or Is Null as a criteria, it works returning all the records so why isn't it working as a part of the IIF statement?




Using checkboxes to update UI in realtime

Evening all,

I'm currenty in the process of trying to develop a smarter UI for one of my clients. However there is a twist! The only code I can use to develop this 'feature', is Pure JS. I have no access to the source HTML or CSS files the only access I have is the ability to inject Javascript through an external .js file. I'm not too farmiliar with JS, but I can work my way around a basic script or two.

Scinario

I'll try to break down the scinario. Essentially what were doing is allowing users to edit PDF Templates online using a software called Core Create. The UI accessed through the browser is quite cluttered and I would like to provide an option to hide and show UI elements <textareas>/<inputs> through the use of checkboxes.

Here is a very basic JS Fiddle that I have built with the intention of hiding and displaying UI.

The page in question

enter image description here

Above is a screen grab of the page I am working with, on the left you can see the UI and its composition on the right within the 'Inspect Element' tool.

I have come to the conclusion that I need to iterate through the highlighted selection and link them accordingly with seven checkboxes. The result would then be a selection of checkboxes that would hide / display the correct UI element.

The Caveat

In realising I cannot edit or introduce new HTML I noticed the lack of on-click attributes. So I'm a bit lost on how to invoke the Javascript I will eventually build.

My Question

With my limited knowledge of JS I don't know how I would iterate though div elements editoraccvar - editoraccvar6 picking out the ones I need to manipulate.

Due to the lack of ID's / Names (I assume it would have to be done using Parent/Child rules somehow, as the classes are widley used by the rest of the UI. I would appreciate a small example demonstrating how I could achieve this, so I can learn from it.




how do I pass the selected parameters in the checkbox from one jsp page to another jsp page?

I have to make the switch to selected values ​​within some checkboxes in a jsp page but after the selection and after pressing the "Send" button, I generate this error with the following description: HTTP Status 400: The request sent by the client was syntactically incorrect.

Where am I wrong?

TaskController.java

@RequestMapping(value="/newTask", method = RequestMethod.GET)
    public String task(@ModelAttribute Task task, Model model) {
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        String s = auth.getName();
        Student student = studentFacade.retrieveUser(s);
        List<Job> jobs = new ArrayList<>();
        if(!(auth instanceof AnonymousAuthenticationToken)) {
            jobs = facadeJob.retriveAlljobs();
            model.addAttribute("job", getMathRandomList(jobs));
            model.addAttribute("image", imageFacade.retriveAllImages());
            List<Image> img = imageFacade.retriveAllImages();
            task.setImages(img);
            task.setStudent(student);
            taskFacade.addTask(task);
            List<Long> images = new ArrayList<>();
            for(Image i : img)
                images.add(i.getId());
            model.addAttribute("images", images);


        }
        return "users/newTask";
    }

    @RequestMapping(value="/taskRecap", method = RequestMethod.POST)
    public String taskRecap(@ModelAttribute Task task, Model model,BindingResult result) {
        model.addAttribute("task", task);
        return "users/taskRecap";
    }

newTask.jsp

<form:form method="post" action="taskRecap" modelAttribute="task" name="form">
    <form:checkboxes path="images" items="${images}"  value="yes" />
        <td><input type="submit" value="Send" /></td>
 </form:form>

taskRecap.jsp

Immages

<c:forEach var="image" items="${task.images}">
        <c:out value="${image.id}" />
        </c:forEach>

Task.java

@Entity
public class Task {

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @ManyToOne
    private Student student;
    @ManyToMany
    List<Image> images;


    public Student getStudent() {
        return student;
    }

    public void setStudent(Student student) {
        this.student = student;
    }

    public Task() {

    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Task(Long id, Student student, List<Image> images) {
        super();
        this.id = id;
        this.student = student;
        this.images = images;
    }

    public List<Image> getImages() {
        return images;
    }

    public void setImages(List<Image> images) {
        this.images = images;
    }
}




Asp.net MVC check/uncheck the checkbox based on a value?

I am working on asp.net MVC 5, i have added a bootstrap toggle switch of type checkbox in input field like bellow

 <input id="test_id" name="cmdName" type="checkbox" checked data-toggle="toggle">

I want to do Check/Uncheck the checkbox based on On or Off value

Note: By default it's always on

I want to do something like this in my Javascript

If(command == "On")
{
  //then it will check the checkbox
}
else if (command =="Off")
{
  //then it will uncheck the checkbox     
}

I have found many similar questions related to it and I tried to implement it but all in vain

The links are bellow

  1. Link 1
  2. Link 2
  3. Link 3
  4. Link 4

Also i have tried to add $('input:checkbox[name=cmdName]').attr('checked', false); including setAttribute , removeAttribute , .prop and many others, but couldn't accomplished the task and i don't know what is the problem

I am using jquery 3.1.0 and bellow are my references

<head>
<title>@ViewBag.Title</title>
@*All the javascript and css files that are required by the
    application can be referenced here so that there is no
    need to refrence them in each and every view*@


<script type="text/javascript" src="~/Scripts/jquery-3.1.0.min.js"></script>
<script src="~/Scripts/bootstrap-toggle.js"></script>
<link href="~/Content/bootstrap-toggle.css" rel="stylesheet" />
<link href="~/Content/bootstrap.css" rel="stylesheet" />
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<link href="~/Content/DataTables/css/jquery.dataTables.min.css" rel="stylesheet" />
<script type="text/javascript" src="~/Scripts/DataTables/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="~/Scripts/bootstrap.min.js"></script>
<script src="http://ift.tt/2cQpfCy"></script>


<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
<link rel="icon" href="favicon.ico" type="image/ico" />
<link rel="shortcut icon" href="~/favicon.ico" /></head>

Any help would be appreciated




MDL checkbox issue: don't want the label to activate the checkbox

I have a Material Design Lite checkbox whose label includes a link to Ts&Cs; but clicking on the link activates the checkbox. The code looks like this:

<label mdl class="mdl-checkbox mdl-js-checkbox mdl-js-ripple-effect" for="checkbox-1">
    <input mdl type="checkbox" id="checkbox-1" class="mdl-checkbox__input" [(ngModel)]="loginRegisterData.termsConditions" #termsConditions (keyup.enter)="clickRegisterButton()">
    <span class="mdl-checkbox__label">I agree to the <a (click)="setVisiblePanel(5)" class="mouseHand">Terms and Conditions</a></span>
</label>

I don't really want the link to activate the checkbox. I have tried various renaming labels to divs, moving divs outside labels and so on, but haven't found a solution that looks decent.

I have checked on the MDL website, and it seems there is no standard way to configure checkboxes in this way. Any ideas?




C# MVC 5 - Make Html.CheckBox() render the hidden input first and then the checkbox input

As we all might know the data Htmlhelper Html.CheckBox(m => m.SomeField) renders two input fields:

<input id="Model_SomeFields" name="Model_SomeFields" type="checkbox" value="true">
<input name="Model_SomeFields" type="hidden" value="false">

Can I somehow manipulate the order so that the hidden field is rendered first?

I want this HTML output:

<input name="Model_SomeFields" type="hidden" value="false">
<input id="Model_SomeFields" name="Model_SomeFields" type="checkbox" value="true">

If not, how can I see the source for CheckBox so I can override it?




jeudi 29 septembre 2016

Android save custom listview checkbox state in sharedprefrences issue

i have a custom listview with textview and checkbox . i want to save the checkbox state in sharedprefrences and get and set it again adaptor when activity open . i have also done this but issue is this i save the checkbox checked position in sharedprefrences and get it . when listview item postion change then my checked checkbox postion got wroung checked how can i handle this.here is my adaptor code.

public class Listadapter extends BaseAdapter {
    CheckBox checkBox;
    boolean index[];
    boolean[] itemChecked;
    ResolveInfo entry;
    String[] itempkg;
    private Context mContext;
    private List<ResolveInfo> mListAppInfo;
    private PackageManager mPackManager;
    private ArrayList<Boolean> checkList = new ArrayList<Boolean>();

    public Listadapter(Context applicationContext, List<ResolveInfo> installedApplication, PackageManager packageManager)
    {
        //super(applicationContext,textViewResourceId,installedApplication);
        super();
        this.mContext = applicationContext;
        this.mListAppInfo = installedApplication;
        index = new boolean[installedApplication.size()];
        this.mPackManager = packageManager;
        for (int i = 0; i < installedApplication.size(); i++) {
            checkList.add(false);
            itemChecked = new boolean[installedApplication.size()];
            itempkg = new String[installedApplication.size()];
        }
    }
    @Override
    public int getCount()
    {
        return mListAppInfo.size();
        //return ((null != mListAppInfo) ? mListAppInfo.size() : 0);
    }
    @Override
    public Object getItem(int position)
    {
        // index = new boolean[mListAppInfo.size()];
        return mListAppInfo.get(position);
    }
    @Override
    public long getItemId(int position)
    {
        return position;
    }
    @Override
    public View getView(final int position, View convertView, ViewGroup parent)
    {
        final ViewHolder holder;
        LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);

        if (convertView == null) {
            convertView = inflater.inflate(R.layout.list_item, null);
            holder = new ViewHolder();
            // reference to convertView
            holder.tvAppName = (TextView) convertView
                    .findViewById(R.id.textView1);
            holder.tvPkgName = (TextView) convertView
                    .findViewById(R.id.textView);
            holder.checkBox = (CheckBox) convertView
                    .findViewById(R.id.checkBox1);
            holder.ivAppIcon = (ImageView) convertView
                    .findViewById(R.id.imageView);
            convertView.setTag(holder);
        } else {

            holder = (ViewHolder) convertView.getTag();
        }
        entry = mListAppInfo.get(position);
        holder.ivAppIcon.setImageDrawable(entry.loadIcon(mPackManager));
        holder.tvAppName.setText(entry.loadLabel(mPackManager));
        holder.tvPkgName.setText(entry.activityInfo.packageName);
        holder.checkBox.setChecked(false);

        if (itemChecked[position])
            holder.checkBox.setChecked(true);
        else
            holder.checkBox.setChecked(false);

        final View finalConvertView = convertView;
        holder.checkBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                // TODO Auto-generated method stub
                if (holder.checkBox.isChecked()) {
                    itemChecked[position] = true;

                } else {
                    itemChecked[position] = false;
                }
            }
        });
        return convertView;
    }
    public void setItemChecked5(boolean[] items5) {
        itemChecked = items5;
    }
    private class ViewHolder
    {
        private ImageView ivAppIcon;
        private TextView tvAppName;
        private TextView tvPkgName;
        private CheckBox checkBox;
    }
} 

here is my activity code.

public class Profile5Activity extends AppCompatActivity implements AdapterView.OnItemClickListener {

        ListView apps5;
        PackageManager packageManager5;
        static ArrayList<String> checkedValue5;
        Button bt5;
        ResolveInfo pi5 = new ResolveInfo();
        Context context = this;
        static String currentApp5 = "NULL";
        CheckBox cb5;
        Listadapter Adapter5 = null;
        boolean[] itemChecked5;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile5);

        itemChecked5 = new boolean[AllApps.getInstalledApplication(this).size()];
        //needPermissionForBlocking(MainActivity.mainContext);
        apps5 = (ListView) findViewById(R.id.list5);
        packageManager5 = getPackageManager();

        final boolean[] items5 = new boolean[AllApps.getInstalledApplication(this).size()];

        SharedPreferences preferences5 = context.getSharedPreferences("YOUR_APP_NAME5", Context.MODE_PRIVATE);
        for (int i = 0; i < AllApps.getInstalledApplication(this).size(); ++i) {
            items5[i] = preferences5.getBoolean("checkbox_5" + i, false);
        }

        Adapter5 = new Listadapter(this, AllApps.getInstalledApplication(this), packageManager5);
        Adapter5.setItemChecked5(items5);
        apps5.setAdapter(Adapter5);
        apps5.setOnItemClickListener(this);

    }

    @Override
    public void onItemClick(AdapterView<?> arg0, final View v, final int position, long arg3)
    {
        // TODO Auto-generated method stub

        CheckBox cb5 = (CheckBox) v.findViewById(R.id.checkBox1);
        final TextView tv5 = (TextView) v.findViewById(R.id.textView);
        final TextView tvv5 = (TextView) v.findViewById(R.id.textView1);
        cb5.performClick();

        if (cb5.isChecked()) {
            checkedValue5.add(tv5.getText().toString());
            itemChecked5[position] = true;
            String pname = (tvv5.getText().toString());
            SharedPreferences preferences1 = context.getSharedPreferences("YOUR_APP_NAME5", Context.MODE_PRIVATE);
            SharedPreferences.Editor edit = preferences1.edit();
            edit.putBoolean("checkbox_5" + position, true);
            edit.commit();

        } else if (!cb5.isChecked()) {
            checkedValue5.remove(tv5.getText().toString());
            String pname = (tvv5.getText().toString());
            SharedPreferences preferences1 = context.getSharedPreferences("YOUR_APP_NAME5", Context.MODE_PRIVATE);
            SharedPreferences.Editor edit = preferences1.edit();
            edit.putBoolean("checkbox_5" + position, false);
            edit.commit();
        }
    }
}

all things working fine in this code until the list item position change when list item postion changed then i got wroung checked value please help me with some code or edit my code where i made mistake i really thankful to you.




Jquery Checkbox remains check on click

I have a checkbox that needs to remain check once user click on the input box.

Issue: On First Click the checkbox is checked, which works fine. When input is clicked again, the checkbox becomes unchecked.

Output Needed:

I want the checkbox to stay checked as this triggers a change event.

I have searched many examples to find this solution but could not find it.

Any help is appreciated.

Please See Fiddle:

http://ift.tt/2dvQAIK

JS:

$('input').click(function() {
     $('#x').text(this.checked ? "is checked" : "is not checked");
 });
 $('.b2').click(function() {
      $('.trigger').click();
 });




How get values from a bootstrap checkboxes button group?

I'm trying to use Boostrap buttons checkboxes plugin. It works good for submitting data, However I would like to get it's values at client using JS (jQuery).

If they are regular input, then I should only read the "checked" parameter.

The inputs "checked" parameter does not changes when the bootstrap plugin is active, neither the "value" parameter changes. (seriously, they don't change)

How can I get the selected checkboxes when the Bootstrap Button plug-in is active?

I'm using Chrome 53 and inspecting my project and the Bootstrap site itself with same behaviour




R Shiny : how to use checkboxGroupInput values for a search in a table?

I'm a beginner on R et Shiny.

For example, I've added the variable "Group" to the data frame "mtcars" in characters format. Now I have 3 groups of cars : "1", "2" and "3", depending on the "mpg" level of each car.

I have coded that for ui :

library(shiny)

ui <- fluidPage(
checkboxGroupInput("dynamic", "Variables to show:",
                 c("Group 1" = "1",
                   "Group 2" = "2",
                   "Group 3" = "3")),

verbatimTextOutput("input_type_text")

)

And that for server :

server <- function(input, output) {
output$data <- renderTable({
mtcars[, c("Group", input$variable), drop = FALSE]
}, rownames = TRUE)

output$input_type_text <- renderText({input$dynamic})

} 

How could I put a second TextOutput box which shows the number of cars of the group(s) I have selected in the checkboxGroupInput. Of course, if I select 2 groups, the TextOutput box will show the number of cars of these selected groups.

Please how can I do that ?

Sorry for my English.

Thank you very much to everybody.




vba hierarchical check boxes

I have the following sample for a case I am trying to implement

http://ift.tt/2dvdjVe

I have cat1, Cat 2 & cat 3, with sub categories under each. When the user selects or un-select this category on DRG summary sheet, its corresponding instances on DRG Target should get selected. (I still haven't got to the part where the opposite should work, so if one or more child category are selected, the parent gets selected. Ideas for that are appreciated)

I have a flag for this, which is being updating but only when I manually run the macro. I want to be able to call the macro from a change event. Any suggestions?




Jquery not passing checkbox values correctly

I am attempting to make interactive checkboxes for my site which display a pop up once you tick a certain value. I have it mostly working however it wont seem to pass the names of the checkboxes to my alert test. It will always display question1 no matter which checkbox I use.

<script async  src="http://ift.tt/13qgtmt"></script>
<script>


function HasChanged()
{
    if($('.common_question').is(":checked")) 
    {  
        alert($('.common_question').val());
    }
}

</script>
<div id="chkbox" style="width=75%">
<form method="post">
        <fieldset>
                <legend>Select your reason for contact from below.</legend>
                        <h2>Premium Accounts</h2>
                        <input type="checkbox" onchange="HasChanged()" class="common_question" name="questiontype" value="question1" />I want to purchase a premium account<br />
                        <div style="display:none" id="prem1">Answer is here </div>
                        <input type="checkbox" onchange="HasChanged()" class="common_question" name="questiontype" value="question2" />I want to cancel a premium account<br />
                        <input type="submit" value="Next" />
        </fieldset>
</form>    
</div>

I am stumped as where I am going wrong, I just want the alert to just display the correct checkbox that has been picked.




Checkbox arrays looping issue

I have 5 checkboxs, my array has 3 elements if the array element same as checkbox value then that checkbox checked but it should print only one time

<?php
$selvals = array("Manhattan", "Bronx", "Brooklyn");
    $myArray = explode(',', $selvals);
    foreach($myArray as $i)
    {

    ?>

    <label class="checkbox-inline"><input type="checkbox" <?php if($i == "Manhattan"){ echo 'checked="checked"';}?> name="manhattan" value="Manhattan" >Manhattan</label>
    <label class="checkbox-inline"><input type="checkbox" <?php if($i == "Bronx"){ echo 'checked="checked"';}?> name="bronx" value="Bronx" >Bronx</label>
    <label class="checkbox-inline"><input type="checkbox" <?php if($i == "Brooklyn"){ echo 'checked="checked"';}?> name="brooklyn" value="Brooklyn" >Brooklyn</label>
    <label class="checkbox-inline"><input type="checkbox" <?php if($i == "Queens"){ echo 'checked="checked"';}?> name="queen" value="Queens" >Queens</label>
    <label class="checkbox-inline"><input type="checkbox" <?php if($i == "Staten Island"){ echo 'checked="checked"';}?> name="staten" value="Staten Island" >Staten Island</label>

    <?php
    }
    ?>




Parse error: syntax error, unexpected T_STRING checkbox php [duplicate]

This question already has an answer here:

im getting following error at a simple php form with multiple checkboxes which should save the checkbox infos to CSV as a comma separated string or smthg like that: "Parse error: syntax error, unexpected T_STRING" Hope someone can help, im new in php.

HTML Form:

    <label>
      <input type="checkbox" name="chk_group[]" value="value1">
      Value1</label>
    <br>
    <label>
      <input type="checkbox" name="chk_group[]" value="value2">
      Value2</label>
    <br>
    <label>
      <input type="checkbox" name="chk_group[]" value="value3">
      Value3
    </label>

PHP Code:

<?php

 $dz=fopen("x.csv","a");
    if(!$dz)
      {
        echo "File could not open.";
        exit;
      }

fputs($dz,$_POST["Name"].";"
    implode(',',$_POST['chk_group']).";"
    .$_POST["month"].";"
    .$_POST["month2"].";"
    .$_POST["textarea"].";\n");

    echo "Sent.";

fclose($dz);`

?>




Type checking case sensitive [duplicate]

This question already has an answer here:

I got a question because I got stuck in checking the type of the object. I have the following situation:

<span class="checkbox">
  <input id="id1" type="checkbox" name="id1">
  <label for="id1"> check me</label>
</span>

<textarea cols="40" rows="10" id="id2" type="text" name="id2"></textarea>

I have a checkbox and a text area. Now I wrote some code which checks the object based on their type or tagname:

// TYPE
var type = $('#id1').attr('type');
$('.result').append("type: ", type);

// Type checking
if (type == "checkbox") {
    $('.test').append("[1] yes found one <br/>");
}
else{
    $('.test').append("[1] ahw I found an error");
}
// This will fail because case sensitive
if (type == "Checkbox") {
    $('.test').append("[2] yes found one");
}
else{
    $('.test').append("[2] ahw I found an error");
}

// TAGNAME
var tagname = $('#id2')[0].nodeName;
$('.result2').append("tagname: ", tagname);

// tagName checking
if (tagname == "TEXTAREA") {
    $('.test2').append("[1] yes found one <br/>");
}
else{
    $('.test2').append("[1] ahw I found an error");
}
// This will fail because case sensitive
if (tagname == "textarea") {
    $('.test2').append("[2] yes found one");
}
else{
    $('.test2').append("[2] ahw I found an error");
}

What I noticed is that for both objects, text area and checkbox, using the type and nodeName checking ends up in case sensitive problem. I can write multiple if statements that try to catch the desired case, e.g: Checkbox, CHECKBOX, checkbox etc.

So I was wondering what should be the best way to type check the object without knowing if it is case sensitive or having a pattern like for example this: CheCkBox?

Demo of my code can be found here: JSFIDDLE




F# JQuery Ajax Post

I'm trying to make an Ajax Post to my F# controller so I can call a method, that will print and simple string. Eventually instead of string being displayed, information selected via a checkbox on the webpage will be inserted into a database.

I have been trying to use this to help but I don't really understand it.

My JQuery code at the momment:

$(document).ready(function () {
    $('#Add').click(function () {
        var id = [];
        $(':checkbox:checked').each(function (i) {
            id[i] = $(this).val();
        });

        if (id.length === 0) {
            alert("Please select at least one checkbox")
        }
        else {
            POST REQUEST GOES HERE.
        }
        console.log();
    })
});

My controller looks like this:

member this.PostInsertData (Insert : string) =  
        System.Diagnostics.Debug.WriteLine("Called method insert data into table")
        Table.insertDataTest
        //http://localhost:48214/api/user/insert
        //^Link to post request

My insertDataTest method:

let insertDataTest  =
    System.Diagnostics.Debug.WriteLine("Method Called!")




Display Edit Button Upon Checked Checkbox

I have an HTML Table with the last column being a column with checkboxes. I want it be so that whenever I check the checkbox, an edit button pops up right next to the table and allows me to edit that row.

Right now, on load, the edit button is already there and when a checkbox is checked, it does nothing.

How can I fix this?

HTML/PHP code:

<html>
    <head>
        <title>Stage Rebate Master HTML Table</title>
        <link rel="stylesheet" type="text/css" href="html_master.css">
        <script type="text/javascript" src=jquery-1.8.3.js></script>
        <script src="html_master.js"></script>
    </head>
<body>

<table id="html_master">
<thead>
    <tr>
    <td>MR_ID</td>
    <td>MR_Name</td>
    <td>Buyer_ID</td>
    <td>MR_POC_N</td>
    <td>MR_POC_E</td>
    <td>MR_POC_P</td>
    <td>Select</td>
    </tr>
</thead>
<tbody>

<?php
    foreach ($dbh->query($sql) as $rows){
    ?>
    <tr>
        <td id="mr_id"><?php echo intval ($rows['MR_ID'])?></td>
        <td id="mr_name"><?php echo $rows['MR_Name']?></td>
        <td id="buyer_id"><?php echo $rows['Buyer_ID']?></td>
        <td id="poc_n"><?php echo $rows['MR_POC_N']?></td>     
        <td id="poc_e"><?php echo $rows['MR_POC_E']?></td>
        <td id="poc_p"><?php echo $rows['MR_POC_P']?></td>
        <td align="center"><input type="checkbox" name="check" value="checked"></td>
        </tr>
 <?php
  }
 ?>
</tbody>
        <input type="button" class="add" value="Add Row" onclick="addRow('html_master')">  
        <input type="button" id="edit" value="Edit" name="edit">
        <input type="button" id="delRow" value="Delete" onclick="deleteRow('html_master')">
</table>

</body>
</html>

Relative Javascript:

 $(document).ready(function() {

     var $submit = $("#edit").hide(),
         $cbs = $('input[name="check"]').click(function() {
             $submit.toggle( $cbs.is(":checked") );
         });

 });




how add fa-fa icon in checkbox but it must appears at the end

suppose to have a dropdown menu and I want that when I clinck on the menu I see the checkbox, the label and at the end the fa-fa icon.This is my jquery code when I put the checkbox on the menu:

$('#ul_menu').append('<li><input type="checkbox" name="aggiungi' + user_bookmarked[i].nome_bookmarked + '">     ' + user_bookmarked[i].nome_bookmarked + '<i class="fa fa-lock fa-1" aria-hidden="true"></i></li>');

I see the "fa fa-lock" attached to the checkbox label I want to appears at the end of the menu. Anyone can help me?

THIS IS MY HTML CODE:

div class="btn-group open"><button id="bookmarked_button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="true" type="button"><span class="visible-sm-inline visible-md-inline visible-lg-inline">Bookmarked</span><span class="caret"></span></button><ul class="dropdown-menu dropdown-menu-right" id="ul_menu"><li><input type="checkbox" name="aggiungidsfsdf" checked="">        dsfsdf</li><li><input type="checkbox" name="aggiungiasdas">     asdas<i class="fa fa-lock fa-1" aria-hidden="true"></i></li><li><input type="checkbox" name="aggiungicollaborativo">        collaborativo<i class="fa fa-lock fa-1" aria-hidden="true"></i></li><li><a href="#" id="aggiungi_bookmarked"><i class="fa fa-fw fa fa-plus"></i>Aggiungi Bookmarked</a></li></ul></div>




advanced sql statement executing checkbox checked

I have in my html code a checkbox and a submit button :

<form action="checkboxes.php" method="post">
    <input type="checkbox" name="checkbox1" value="Yes">4K</input>
    <input type="submit" name="formSubmit" value="Submit" ></input>
</form>

And in my php i have a file "config.php" that his function is to connect to my database :

<?php
/* Database connection */

$sDbHost = 'localhost';
$sDbName = 'testowanie';
$sDbUser = 'root';
$sDbPwd = '';
$dbcon = mysqli_connect ($sDbHost, $sDbUser, $sDbPwd, $sDbName);
?>

And a second php file :

<?php
include('config.php');

$sqlget = "SELECT * FROM monitory";
$sqldata = mysqli_query($dbcon, $sqlget)or die("Can't connect to the database");

if(isset($_POST['checkbox1']) && 
   $_POST['checkbox1'] == 'Yes')
{
   while($row = mysqli_fetch_array($sqldata, MYSQLI_ASSOC)) {
           echo '.';
           echo $row['cena'];
   }
}
?>

This all three connected files each others do that if the checkbox is checked this sql statement are executed : "SELECT cena FROM monitory;" but i want to execute this statement : "SELECT * FROM monitory WHERE cena=1000;" I tried to do this like around 2hours but i really don't now how to do this.

Thanks,




jqGrid - add Checkbox in toolbar dropdown

I'm trying to add checkbox in dropdown of jqGrid Toolbar, but I can't able to figure out how to do it. I have a multiselect box which is working fine but I want to replace it with checkbox which will be visible on dropdown.

My code is

{
    name: 'Status',
    index: 'account.status',
    searchoptions: {
        sopt: ['eq'],
        value: ":All;0:Pending;1:Warming;2:Running;3:Dead;4:ID Verification",
        multiple: true
    },
    stype: 'select'
}

I have also attached screenshot for better understanding.

This is what I have

enter image description here

This is what I need

enter image description here

Any suggestion will be very helpfull for me.

Thanks in advance.




how can i add multiple value from listcheckedbox?

how can i add multiple value from listcheckedbox ? i have search in engine many of them store it with count first and the checked value. is there a way just get the selected value ? error

the code i use.

  public void savenote()
    {
        DataTable dtsvnote = new DataTable();
        DataSet dssvnote = new DataSet();
        SqlCommand command = new SqlCommand();
        SqlDataAdapter adapter = new SqlDataAdapter();
        SqlParameter para1 = new SqlParameter();
        try
        {
            dtsvnote.Clear();
            dssvnote.Clear();
            command.Connection = myConnection;
            command.CommandText = "UPDATE member " +
                "set note ='" + checkedListBoxControl1.SelectedItems.ToString()+"," + "' WHERE userid= '" + 734 + "';";                                     

            myConnection.Open();
            adapter.UpdateCommand = command;
            command.ExecuteNonQuery();
        }
        catch (Exception ex)
        {
            MessageBox.Show("error" + ex);
        }
        myConnection.Close();
    }

the display of form

note

so it the output become greatenergy;listenwell

if its duplicate please send the link.




Checkbox is not getting selected while running but it gets selected in debug mode(eclipse)

I have tried running this code on both the browsers but the checkbox is not getting selected while running but it does get selected in debug mode. Please find the code:enter image description here




mercredi 28 septembre 2016

How to update the database if i change the dropdown list element and checkbox value

I have created one form in that i have put one drop down list and group of checkbox. 1)If user select any item from that drop down list than particular item should updated in database(Ex.first user has select division A from drop down list than the A should enter into database and if after some time same user change division from A to B than in database in place of A data should B when user press update button. 2)In the group of checkbox if user change (select or deselect) checkbox compare to previous input than respective checkbox value should updated in database.(Ex. If user has checked two checkbox than the particular checkbox value should update in database and after some time same user has checked all three checkbox or only one checkbox and particular change should update in database when user click on update button Here i have put my code. If anyone know solution than please help. Thanks in advance.

<?php
$connection = mysql_connect("localhost", "root", "");
$db = mysql_select_db("db_new", $connection);
$query=mysql_query("SELECT * FROM student_info where id=17");
$row= mysql_fetch_row($query);
$rollno = $row[1];
$name = $row[2];
$division= $row[3];
$std = $row[4];
$gender = $row[5];
$subject=mysql_query("select * from student_info where id=17");
while($fetch=mysql_fetch_object($subject))
{
    $r=$fetch->subject;
    $sub=explode(",",$r);
}
if(count($_GET)>0){
    $rollno=$_GET['rollno'];
    $name=$_GET['name'];
    $std=$_GET['std'];
    $gender=$_GET['gender'];
    $update=mysql_query("update student_info set roll_no='$rollno', name='$name',
    std='$std', gender='$gender' where id='17'",$connection);
}
mysql_close($connection);
?>
<!DOCTYPE html>
<html>
<head>
    <title>Edit Form</title>
    <script src="http://ift.tt/1rKdStd"></script>
    <script src="jquery%20validate/jquery.validate.min.js"></script>
    <script src="jquery%20validate/additional-methods.min.js"></script>
    <script src="form.js"></script>
</head>
<body>
<form id="editform" method="GET" action="task.php">
    <div>
        <h1>Form</h1>
        <label><b>Roll No:</b></label>
        <input id="rollno" name="rollno" type="text" value="<?php echo $rollno ?>"> <br><br>
        <label><b>Name:</b></label>
        <input id="name" name="name" type="text" value="<?php echo $name ?>"> <br><br>
        <label><b>Division:</b></label>
        <select id="division">
            <option value=" " <?php if (!empty($division) && $division == ' ')  echo 'selected = "selected"'; ?>>--select--</option>
            <option value="A" <?php if (!empty($division) && $division == 'A')  echo 'selected = "selected"'; ?>>A</option>
            <option value="B" <?php if (!empty($division) && $division == 'B')  echo 'selected = "selected"'; ?>>B</option>
            <option value="C" <?php if (!empty($division) && $division == 'C')  echo 'selected = "selected"'; ?>>C</option>
            <option value="D" <?php if (!empty($division) && $division == 'D')  echo 'selected = "selected"'; ?>>D</option>
        </select><br><br>
        <label><b>Std:</b></label>
        <input id="std" name="std" type="text" value="<?php echo $std ?>"><br><br>
        <label><b>Gender:</b></label>
        <input type="radio" name="gender" value="male" <?php if($gender=='male'){ echo "checked=checked";}?>>Male
        <input type="radio" name="gender" value="female" <?php if($gender=='female'){ echo "checked=checked";}?>>Female<br><br>
        <label><b>Subject:</b></label><br>
        <input type="checkbox" name="box[]" class="subject" value="maths" <?php if (in_array("maths", $sub)){echo "checked";}?>>maths<br>
        <input type="checkbox" name="box[]" class="subject" value="science" <?php if (in_array("science", $sub)){echo "checked";}?>>science<br>
        <input type="checkbox" name="box[]" class="subject" value="english" <?php if (in_array("english", $sub)){echo "checked";}?>>english<br>
        <input id="submit" type="submit" value="submit">
        <input id="update" type="submit" value="update">
    </div>
</form>
</body>
</html>

database layout




Retrieve data from PostgreSQL database and display in tables - Display certain data according to checkboxes checked

I have created an PostgreSQL database(with pg-admin) which contains more than 10 tables filled with Arsenic test of Different district. i need to generate the html table as per the user input from html form.

Additionally I have put, under my html forms, some check boxes which contains names of districts to be selected and by checking them you can restrict the data of which district to select and which one not.

Each checkbox represent the name of District (which are individual table or schema in PostgreSQL) of my database; so along with the selection of check boxes (user can select one checkbox or multiple), anything that is checked is displayed.

So far I managed to write a php script that connects to the database, display error message when none of my check boxes.

Problem: i know how to select individual district (i.e. District here is individual table) but not able to give multiple choices to user.

Information: All tables have same column name and only data differs as per change in district name.

what i have done:- I have visited many solutions in Stakoverflow but all of the suggest me to select the fields of same table dynamicaly but not of tables i have visited:-

http://ift.tt/2dbtbOP

This is a simple html form for only Two district to check.

<html>
    <head>
    <title>Jasper Report</title>
        </head>
        <body>
        <h1 align="center">ARSCENIC TEST REPORT</h1>
        <b>Districts: </b> <br>
        <form method="post"  action="app.php">
          <input type="checkbox" name="reg1" value="Banke" checked /> Banke<br>
          <input type="checkbox" name="reg2" value="Bara" /> Bara <br><br>
            <input type="submit" value="Generate"/>
        </form>
        </body>
        </html>

the PHP code for the selection of individual district table is

 <?php
    require_once __DIR__ . "/vendor/autoload.php";
    use Jaspersoft\Client\Client;

    $c = new Client(
            "localhost",
            "8080",
            "jasperadmin",
            "jasperadmin",
            "/jasperserver"
          ); 


          //$dist = $_GET['dist'];
          //echo $dist;

       $db = pg_connect('host=localhost port=5433 dbname=BankeDB user=postgres password=admin'); 


      $userclass = array('0-5','6-10','11-15', '>15','Total');


     $btotal = array();

    $query = "select 
    sum(case when ".'"district_n"'." ='Banke' AND ".'"vdc_name"'."='Belahari' AND ".'"NO_OF_USERS"'." <= '5' AND ".'"conc_arsc"'." <= '10' then 1 else 0 end),
    sum(case when ".'"district_n"'."='Banke' AND ".'"vdc_name"'."='Belahari' AND ".'"NO_OF_USERS"'." >= '6' AND ".'"NO_OF_USERS"'." <= '10' AND ".'"conc_arsc"'." <= '10' then 1 else 0 end),
    sum(case when ".'"district_n"'."='Banke' AND ".'"vdc_name"'."='Belahari' AND ".'"NO_OF_USERS"'." >= '11' AND ".'"NO_OF_USERS"'." <= '15' AND ".'"conc_arsc"'." <= '10' then 1 else 0 end),
    sum(case when ".'"district_n"'."='Banke' AND ".'"vdc_name"'."='Belahari' AND  ".'"NO_OF_USERS"'." > '15' AND ".'"conc_arsc"'." <= '10' then 1 else 0 end),
    sum(case when ".'"district_n"'."='Banke' AND ".'"vdc_name"'."='Belahari' AND (".'"NO_OF_USERS"'."<='5' or (".'"NO_OF_USERS"'." >='6' and ".'"NO_OF_USERS"'." <='10') or (".'"NO_OF_USERS"'." >='11' and ".'"NO_OF_USERS"'." <='15') or ".'"NO_OF_USERS"'." >'15') AND ".'"conc_arsc"'." <= '10' then 1 else 0 end)
    from public.".'"Arsenic_Test_Banke"'."";
    //echo $query;


    $btresult = pg_query($db, $query);
    while($btresults = pg_fetch_row($btresult)){
            $count = count($btresults);
            $y = 0;
            while ($y < $count)
            {
                $c_row = current($btresults);
                $btotal[] = $c_row;
                next($btresults);
                $y = $y + 1;
            }

        }


    ?>

    /*
    Other related queries here as above
    */

    <table  width="600" height="300" cellspacing="2" border="1" align="center">
        <tr>
        <th colspan=13>Tubewells by Arsenic Concentration Levels</th>
        </tr>

        <tr>
        <th>User Class (No of Users)</th>
        <th>No.(0-10)</th>
        <th>%(0-10)</th>
        <th>No.(11-50)</th>
        <th>%(11-50)</th>
        <th>No.(51-100)</th>
        <th>%(51-100)</th>
        <th>No.(101-300)</th>
        <th>%(101-300)</th>
        <th>No.(>300)</th>
        <th>%(>300)</th>
        <th>Total</th>
        <th>%</th>
            </tr>

        <tr>

        <?php 
            for($i=0; $i<5; $i++){
        ?>
        <tr>
            <td><?php echo $userclass[$i];?></td>
        <td><?php echo $btotal[$i];?></td>
        <td><?php echo $perb10[$i];?></td>
        <td><?php echo $bettotal[$i];?></td>
        <td><?php echo $pbet[$i];?></td>
        <td><?php echo $b51_100total[$i];?></td>
        <td><?php echo $pb51_100[$i];?></td>
        <td><?php echo $bt101_300total[$i];?></td>
        <td><?php echo $pb101_300[$i];?></td>
        <td><?php echo $abov300total[$i];?></td>
        <td><?php echo $pabov300[$i];?></td>
        <td><?php echo $total[$i];?></td>
        <td><?php echo $ptotal[$i];?></td>


        </tr>
        <?php
                }
        ?>

    </table>


    <?
    pg_close($db);

    ?>

Now the problem is how to make the multiple choices for table so that user can select multiple district at a time to analyze the merged data.

thank you all.




Cannot retrieve data via checkbox in laravel

I have a project in which i want to retrieve value from database via checkbox. But i cannot do this. My controller code is

public function browseProfessionals() {
        $userRoles = UserRole::whereIn('role_id', [2,3])->get();
        $users = array();
        $showUsers = array();

        foreach ($userRoles as $userRole) {
            $users[] = User::find($userRole->user_id);
        }

        $valid_providers = array();
        $all_providers = array();
        $user_role_all_providers = UserRole::where('role_id', 2)->get();

        foreach ($user_role_all_providers as $user_role_all_provider) {
            $all_providers[] = User::where('id', $user_role_all_provider->user_id)->first();
        }

        foreach ($all_providers as $all_provider) {
            $user = User::where('id', $all_provider->id)->first();
            $user_detail = UserDetail::where('user_id', $all_provider->id)->first();
            $user_meeting = UserMeeting::where('user_id', $all_provider->id)->first();
            $user_time = UserTime::where('user_id', $all_provider->id)->first();

            if (!empty($user_detail->avatar) && !empty($user_meeting->meeting_id) && !empty($user_time->hour_rate) && $user->is_active == 1 && $user->is_deleted == 0) {
                $valid_providers[] = $all_provider;
            }
        }

        $data = [
            'valid_providers' => $showUsers,
            'industries' => Industry::where('is_active', 1)->where('is_deleted', 0)->get(),
            'degrees' => UserDegree::where('degree_id', $user->degree_id)->get(),
        ];
        return view('frontends.browse-professionals', $data);
    }

My Blade template is

@extends ('frontends.layouts.app')
@section ('main')
    <div id="content-block" class="margin-top-140">
        <div class="container-fluid block custom-container">
            <h3 class="block-title">Browse Professionals</h3>
            <div class="block-subtitle"><span>Connect</span> <span>Learn</span> <span>Inspire</span> <span>Thrive</span> </div>
            <div class="row">
                
                    <div class="col-md-2 left-feild">
                        <div class="margin-bottom-30">
                            <h3>Search Filters</h3>
                        </div>
                        @if(Auth::check() && Auth::user()->user_role->role_id == 1000000)
                            <div class="be-vidget">
                                <h3 class="letf-menu-article"> Looking To </h3>
                                <div class="creative_filds_block">
                                    <div class="radio">
                                        <label><input type="radio" name="lookingTo" onclick="lookingTo(2)"> Seek Advice</label>
                                    </div>
                                    <div class="radio">
                                        <label><input type="radio" name="lookingTo" onclick="lookingTo(3)"> Share Advice</label>
                                    </div>
                                </div>
                            </div>
                            <script>
                                function lookingTo(e) {
                                    $.ajax({
                                        type: 'POST',
                                        url: '/' + e,
                                        success: function (result) {
                                            $('#browse_professionals').html(result);
                                        }
                                    });
                                }
                            </script>
                        @endif
                        <div class="be-vidget">
                            <h3 class="letf-menu-article">Professionals</h3>
                            <div class="-creative_filds_block">
                                <div class="fp-panel-wrap">
                                    <a class="toggle-btn active" onclick="open_industry()" href="#" data-target="#ul_industry" id="a_industry">Industry</a>
                                    <ul id="ul_industry" class="fp-panel open" style="overflow:scroll; height:200px;">
                                        @if(!empty($industries))
                                            @foreach($industries as $industry)
                                                <li value=""><a href="javascript:void(0)" onclick="industry_search()"></a> </li>
                                            @endforeach
                                        @endif
                                    </ul>
                                    <script>
                                        function industry_search(e) {
                                            $.ajax({
                                                type: 'POST',
                                                url: '/' + e,
                                                success: function (result) {
                                                    $('#education_experience').html(result);
                                                    $('#a_industry').attr('class', 'toggle-btn');
                                                    $('#ul_industry').css('display', 'none');
                                                    $('#education_experience').css('display', 'block');
                                                    $('#eduLevel').css('display', 'block');
                                                    $('#areaExperience').css('display', 'block');

                                                }
                                            });
                                        }
                                        function open_industry() {
                                            $('#education_experience').css('display', 'block'); // display none hobe na. collapse hoye jabe
//                                        $('#a_industry').attr('class', 'toggle-btn active');
//                                        $('#ul_industry').css('display', 'block');
                                            $('#education_experience').css('display', 'block');
                                            $('#eduLevel').css('display', 'none');
                                            $('#areaExperience').css('display', 'none');
                                        }
                                    </script>
                                    <div id="education_experience" style="">
                                        <a id="a_education" class="toggle-btn" href="#" data-target="#eduLevel">Education Level</a>
                                        <ul id="eduLevel" class="no-link fp-panel" style="overflow:scroll; height:200px;">


                                            @if(!empty($degrees))
                                                @foreach($degrees as $degree)
                                                    <li value=""></a> </li>
                                                @endforeach
                                            @endif

                                        </ul>
                                        <a id="a_experience" class="toggle-btn" href="#" data-target="#areaExperience">Areas of Experience</a>
                                        <ul id="areaExperience" class="no-link fp-panel" style="overflow:scroll; height:200px;">

                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="be-vidget">
                            <h3 class="letf-menu-article">Meeting Preferences</h3>
                            <label>Price</label>
                            <br> <br>
                            <input type="hidden" id="price_ranger" class="range-slider" value="23"/>


                            <label style="margin-top: 30px;">Type</label>
                            <div class="form-group">
                                <select class="form-input" id="meeting_type">
                                    <option value="3">All</option>
                                    <option value="1">Phone Meeting</option>
                                    <option value="2">Web Meeting</option>
                                </select>
                            </div>
                        </div>

                        <button id="search_professionals" type="button" class="btn color-2 size-2 btn-block hover-1">Apply Filter</button>
                        @if(Session::has('remove_filter'))
                            <button type="button" class="btn btn-danger size-2 btn-block hover-1">Remove Filter</button>
                        @endif

                        <script>
                            var industry = '';
                            $('#ul_industry li').click(function() {
                                industry = $(this).attr('value');
                            });

                            $("#search_professionals").click(function () {
                                var degrees = new Array();
                                $('input[name="degrees_checkbox"]:checked').each(function() {
                                    degrees.push(this.value);
                                });

                                var experiences = new Array();
                                $('input[name="experiences_checkbox"]:checked').each(function() {
                                    experiences.push(this.value);
                                });

                                var price_ranger = $("#price_ranger").val();
                                var price_ranger_array = price_ranger.split(",");
                                var start_price = price_ranger_array[0];
                                var end_price = price_ranger_array[1];

                                var meeting_type = $("#meeting_type").val();

                                $.ajax({
                                    'type' : 'post',
                                    'url' : '',
                                    'data' : {
                                        'industry' : industry,
                                        'educationLevels' : degrees,
                                        'areasOfExperiences' : experiences,
                                        'start_price' : start_price,
                                        'end_price' : end_price,
                                        'meeting_type' : meeting_type
                                    },
                                    'success' : function (result) {
                                        console.log(result);
                                        $('#browse_professionals').html(result);
                                    }
                                });
                            });
                        </script>
                    </div>
                

                <div class="col-md-10">
                    <div id="browse_professionals" class="row _post-container_">
                        @if (!empty($valid_providers))
                            @foreach ($valid_providers as $provider)

                                <div class="category-1 custom-column-5">
                                    <div class="be-post">
                                        <figure class="ratio-4-3 be-img-block-alt">
                                            <div class="ratio-inner" style="background-image: url('')">
                                                <img src="" alt="">
                                            </div>
                                        </figure>
                                        <div class="be-post-title"></div>
                                        <div class="author-post">
                                            <span><a href=""> </a></span>
                                        </div>
                                        <span></span>
                                        <div data-value="4" class="static-rating"></div>
                                        <div class="info-block clearfix">
                                            <a class="btn color-1 size-2 hover-1 pull-right" href="">Contact</a>
                                            <h3 class="rate"> $ /hr</h3>
                                        </div>
                                    </div>
                                </div>
                            @endforeach
                        @endif
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection

Please help me how can i show value via checkbox. Please help me solving this.




angularjs build search criteria with check boxes

Forgive the noob angular question:

I am attempting to aggregate product search terms using check boxes. When a user selects/deselects an check box, the values are returned and filter the product list...

My initial approach was to hard code the product categories and then run a ng-click function that iterated the categories and built the search string... i.e. (product=controllerAs syntax)

<input ng-click="product.changeSearch()" ng-model="product.criteria.form.liquid">
<input ng-click="product.changeSearch()" ng-model="product.criteria.form.solid">

Then on the controller side:

vm.changeSearch = function() {
_.map(vm.criteria.forms, function(criteria) {
        if (criteria) {
            criteriaCompiled.push(criteria);
        }

        console.log('criteria: ', criteriaCompiled);
    });

The ideal output would be "mongo-ready" such that I can run a find.{ form: "Liquid, form: "Solid" } query.

I'm thinking this is the wrong strategy because I have about 20 elements to choose from and the array is proving difficult to map and return meaningful values, especially when looking at true/false checkbox values...

Any practical or theoretical advise is appreciated...




Change check value checkbox form ( Awesomium VB.net)

I tried both, but it won't work. Can anyone help me?

WebControl1.ExecuteJavascript("document.getElementById('#signupForm_confirm_terms').prop('checked'", "true")

WebControl1.ExecuteJavascript("document.getElementById('#signupForm_confirm_terms').attr('checked'", "true")

Thanks in advance :)




SSRS : Wingdings check box not displayed in Chrome and Firefox

I am trying to display the checkbox on the SSRS report based on the value of a Boolean field wingdings font. My expression looks like this.

=IIF(Fields!ColorCheck.Value,chr(254),chr(168))

This works fine in IE but not in Chrome or Firefox.

I tried the Unicode alternate for this (Arial Unicode MS Font) =iif(Fields!ColorCheck.Value,chr(0252),chr(0251))

I get the error "Procedure Call or Argument is not valid"

Is there any workaround for this. any suggestion is greatly appreciated.




Bind checkbox to element of one array in Ember 2+

I'm trying to bind elements of one array to the checked attribute of checkboxes using Ember 2.8. I'm also using this in one component.

The checkboxes show all marked, but whenever I tried to use the action hideOrShowAllColumns it does not mark all checkboxes again if there was one which was not checked... so I guess I'm passing the value of the array element and not the element itself. I don't know how to do this in javascript/ember...

This is my view

 
All

    
    


This is my component.js

export default Ember.Component.extend({
    init() {
        this._super(...arguments);
        this.set('allColumnsChecked', true);
    },
    didReceiveAttrs() {
        this._super(...arguments);
        let columnMap = this.get('columnMap');
        let allColumns = Array(columnMap.length).fill(true);
        this.set('allColumns', allColumns);
    },
    actions: {
         hideOrShowAllColumns() {
            let all = this.get('allColumnsChecked');
            all = !all;
            this.set('allColumnsChecked', all);
            if (all === true) {
                let allColumns = this.get('allColumns');
                allColumns = allColumns.map(() =>  true);
                this.set('allColumns', allColumns);
            }
        },
}

Helper getItemAt

export function getItemAt(params) {
    return params[0][params[1]];
}




Angular custom checkbox directive doesnt work in ng-repeat

I have created a custom directive for checkbox which can be used across my application. i have created the checkbox with the following code.

JS

angular.module("myApp")
    .component("ngCheckbox", {
       template:
           '<div class="ng-control-checkbox">' +
           '<input id="check" type="checkbox" data-ng-model="$ctrl.checked" class="checkbox">' +
           '<label for="check">'+
           '<span data-ng-bind="$ctrl.label"></span>' +
           '</label>' +
           '</div>' +
           '',   

        bindings: {
            label: '=?',
            checked: '='
        },
        controller: function () {
            var $ctrl = this;
        }
    });

CSS

  .ng-checkbox label{
      cursor: pointer;
      margin-left: 20px;
  }
  .ng-checkbox label:before {
     content: "\e911";
     cursor: pointer;
     color: #84919A;
  }
  .checkbox {
    display: none;
  }
  .checkbox:checked + label:before {
   content: "\e910";
    cursor: pointer;
    color: $color_forest_green;
  }

HTML

      <div data-ng-repeat="notification in notificationList" >
        <ng-checkbox data-checked="notification.selected"></ng-checkbox>
      <div>

  • Im using CSS ::before to change the content. i do not want to write any JS for this.
  • i cant change the HTML structure as i have to use the application specific icons as CSS content for the checkbox

Issue

As i am binding the id of the checkbox with the for of the label i am not able to use this checkbox directive inside ng-repeat. i am hoping to get a solution for this as i am stuck on this.

Thanks in advance.




Add only those textbox value whose respective check box is checked

<input type="checkbox" id="checkbox1" />  
<input id="reg11" type="text" name="add-1" class="form-control" value="22" readonly ><br>
<input type="checkbox" id="checkbox2" /> 
<input id="reg11" type="text" name="add-2" class="form-control" value="22" readonly ><br>
<input type="checkbox" id="checkbox3" /> 
<input id="reg11" type="text" name="add-2" class="form-control" value="22" readonly >  

I have three textboxes and respective checkboxes. I want to add only those text box value whose respective checkbox is checked.

jQuery(document).ready(function($) {
    var sum = 0;
    $('#checkbox1').click(function() {
       sum = 0;
       var val1= parseInt($("#add-1").val()); 
       var val2= parseInt($("#add-2").val()); 
       sum=parseInt(val1+val2);
       $('#sum').html(sum);
    });
});




Saving multiple checkbox into localstorage without overwritten

I have a checkbox within a form of which I want it to write to localstorage the status of the checkbox (true/false) upon submission of the form.

So if the user checked the box and clicked submit, the value stored in the localstorage will be "true". However what I don't want is for the data to be overwritten if the user re-opens the app and submit the form again, so for example if the user re-opens the app next time and decide to not check the box on that particular session, the values in the localstorage should be "true, false", and so on.

I think I should use JSON.stringify but not sure exactly how to integrate into here.

Here's my js (I'm using phonegap)

document.addEventListener("deviceready",onDeviceReady,false);

function onDeviceReady() {
            document.getElementById("xbutton").addEventListener("click",savecheck,false); }

function savecheck(){
        var checkb = document.getElementById("MedA");
        localStorage.setItem("MedA", checkb.checked);
    }

html:

<form>
            <div id='medA'>
                <input type="checkbox" id="MedA" name="Med" value="A">Medication A
             </div>
<input id="xbutton" type="button" onClick="savecheck()" value="Submit">
</form>




Change checkbox tick color and icon - sapui5

I need to change the color of the tick on a UI5 checkbox. I've looked at the CSS and found out that this is in the ::before selector: enter image description here

I've added a class to the checkbox, called .accept and defined like this on the CSS file:

.accept.sapMCbBg.sapMCbMarkChecked::before{
        content: "\e05b" ;
    font-family: "SAP-icons" ;
    color: #00a600;
}

This is not working. Do you have any suggestion? Thank you.




Condition on checked property of checkbox in html

How can I put condition on checked property of checkbox?

I have checkboxes for each row in my application. In my database, I have a column 'IsSaved' whose value is either 0 or 1. If IsSaved for a row is 1 then checkbox should automatically be shown as selected.

Here's my code snippet:

<td style="text-align:center;">
    <input type="checkbox" name="select" value="${ID}" ng-checked="${IsSaved} ? true : false" />              
</td>

How can I achieve this?




AngularJs - How to display image in checkbox in ng-grid using condition check

Below is the code where I want to display image in checkbox. This is multi select checkbox.

<div ng-iaf-custom-list="search,views"
                 ng-grid="questionGrid" 
                 ng-data="data/list"
                 ng-schema-data="data" 
                 ng-schema-total="total" 
                 ng-schema-columns="columns" 
                 ng-page-sizes="metadata.pageSizes" 
                 ng-page-size="metadata.pageSize" 
                 ng-refresh="refreshGrid"
                 ng-schema-sort="sortOrder" 
                 ng-schema-filters="filter" 
                 ng-sortable="multiple" 
                 ng-sort="selectedView.sortOrder" 
                 ng-reinit="reinitGrid" 
                 ng-sortable="true" 
                 ng-filterable="true"  
                 ng-selectable="multiple" 
                 ng-on-select="selecteddata = selection">
        </div>




Tkinter checkbox 'Name not defined'

I am currently writing an application that uses Tkinter to provide a graphical interface for the user.

The app has been working very well and recently I decided to add some checkboxes, the idea being that when the user checks one of the boxes, another set of text is sent through an API.

I have input boxes that I am able to get to work perfectly, however for some reason whenever I try and retrieve the value of the checkbox, I get the following error:

     if check.get():
NameError: name 'check' is not defined

For the life of me I can't figure out why this error is popping up, here is the rest of my code, to make it clearer I have removed the working code for the input boxes.

from tkinter import *

class GUI:
    def __init__(self, master):
         check = IntVar()



         self.e = Checkbutton(root, text="check me", variable=check)
         self.e.grid(row=4, column=2)

         self.macro_button = Button(master, text="Test Button", command=self.test)
         self.macro_button.grid(row=11, column=1)



      def test(self):
           if check.get():
                print('its on')
           else:
                print('its off')



root = Tk()
root.resizable(width=False, height=False)
my_gui = GUI(root)
root.mainloop()

When I run this code, and press the button labeled 'test button', that is when the error appears in my terminal.

Anyone have any idea why this is happening for my checkboxes, and not for my inputboxes?

EDIT:

what's even odder for me is that this code that I found online made to teach you how to use a tkinter checkbox works like a charm, and its almost identical to mine:

import tkinter as tk

root = tk.Tk()

var = tk.IntVar()
cb = tk.Checkbutton(root, text="the lights are on", variable=var)
cb.pack()

def showstate():
    if var.get():
        print ("the lights are on")
    else:
        print ("the lights are off")

button = tk.Button(root, text="show state", command=showstate)
button.pack()

root.mainloop()




Hii all I want to give a permission like yes or no using checkbox...so could i handel that..using php

This is my system page which is in form and after saving the form so in server side how can i handel permission one by one

this is my db-table structure according that how can i handel that logic?

 [1]: http://ift.tt/2cKnyqq

 [2]: http://ift.tt/2djN03r




Issue with Bootstrap AdminLTE Checkbox not checkbox

I am using AdminLTE Bootstrap theme in my application and would like to keep a checkbox checked by default. I did the checked=checked also but that doesn't seem to work. Can anyone point out what I am doing wrong?

<div class="form-group">
    <label for="emailoptout" class="col-sm-2 control-label">Email Opt-Out</label>
    <div class="checkbox col-sm-4">
        <label><input type="checkbox" id="emailoptout" name="emailoptout" checked="checked"></label>
    </div>
</div>




Checkbox in react js doesn't change

I have main component as follows :

export default class RegistrationFormStepFour extends React.Component{
constructor(props){
    super(props);
    this.state = {
        terms: false,
        emailNotifications: false,
        smsNotifications: false,
        errors: {}
    }
}


handleTerms(event){
    event.preventDefault();
    this.setState({terms: !this.state.terms});
}

render(){
    const language = this.props.currentLanguage;

    return (
        <div>
            <Terms
                nameYes="chcTerms"
                text={language.termsText}
                state={this.state.terms}
                onChange={this.handleTerms.bind(this)}
                currentLanguage={language}
                error={this.state.errors.terms}/>

        </div>
    );
}
}

And component term is as follows :

import React from 'react';

const Terms = ({nameYes, text, state, onChange, error}) => {

let hasError = error ? "hasError" : "";

return (
    <div className="col-lg-12 text-center" style=>
        <form>
            <label className="radio-inline">
                <input
                    type="checkbox"
                    name={nameYes}
                    checked={state}
                    onChange={onChange}
                    value=""/>
            </label>
        </form>
        <p className={`questionsText ${hasError}`} style=>{text}</p>
    </div>
);
};

export default Terms;

But when I click on the checkbox, nothing happens. If I console log the state in the terms component it show right value. First time is false, when I click on the checkbox than is true, but the checkbox isn't checked.

Any advice?




mardi 27 septembre 2016

Checkbox default check not working with array of name

I have the following code: The following checkbox is not checked by default. While inspecting the element it shows the value as checked. If I use normal name instead of array the code works fine. The above code works fine.




How to get the 'on' value at jquery?

Refer question : How to get multiple checkbox toggle switches values when on change event via jquery

In this how can we get the value 'on' and 'off' at the jquery?




Q:How to check checkbox when entering the id?

I'm new to kendo framework. i would like to ask that is there any way to check the checkbox by entering the id of the checkbox? For example check box id [51,52,53,54,56]. When enter the id of 52 then the check box of 52 would be checked.

var data;
var gridColumns;
var grid;
var showlist;
var viewModel;
var checklist = document.getElementById("checklist");
viewModel = kendo.observable({
  showlist: false,

});

kendo.bind($(checklist), viewModel);

function onChange() {
  viewModel = kendo.observable({
    showlist: true,
  });
  kendo.bind($(checklist), viewModel);
}

var PrimaryProbe = new kendo.data.HierarchicalDataSource({
  data: [{
    id: 5,
    parent_id: 0,
    value: "General - Primary Probe",
    expanded: true,
    items: [{
      id: 51,
      parent_id: 5,
      value: "Agent Running Mode"
    }, {
      id: 52,
      parent_id: 5,
      value: "Agent Version"
    }, {
      id: 53,
      parent_id: 5,
      value: "Master/Slave Mode"
    }, {
      id: 54,
      parent_id: 5,
      value: "Manufacturer"
    }, {
      id: 55,
      parent_id: 5,
      value: "Model"
    }, {
      id: 56,
      parent_id: 5,
      value: "Software Version"
    }]
  }]
});


function onCheck() {
  var message;
  var checkedNodes = [];

  checkedNodeIds(treeView.dataSource.view(), checkedNodes);
  if (checkedNodes.length > 0) {
    message = "IDs of checked nodes: " + checkedNodes.join(",");
  } else {
    message = "No nodes checked.";
  }
  $("#result").html(message);
}

treeView = $("#treeview").kendoTreeView({
  checkboxes: {
    checkChildren: false,
    template: "# if(!item.hasChildren){# <input type='hidden' parent_id='#=item.parent_id#' d_text='#=item.value#'/> <input type='checkbox'  name='checkedFiles[#= item.id #]' value='true' />#}else{# <input type='hidden' parent_id='#=item.parent_id#' d_text='#=item.value#'/> #}#"
  },
  check: onCheck,
  dataSource: PrimaryProbe,
  dataTextField: "value"
}).data("kendoTreeView");

function checkedNodeIds(nodes, checkedNodes) {
  //console.log(nodes);
  for (var i = 0; i < nodes.length; i++) {
    if (nodes[i].checked) {
      checkedNodes.push(nodes[i].id);
    }
    if (nodes[i].hasChildren) {
      checkedNodeIds(nodes[i].children.view(), checkedNodes);
    }
  }
}
$("#get").click(function() {

  alert(checklist.value)
});
#fieldlist {
  margin: 0;
  padding: 0;
}
#fieldlist li {
  list-style: none;
  padding-bottom: 1.5em;
  text-align: left;
}
#fieldlist label {
  display: block;
  padding-bottom: .3em;
  font-weight: bold;
  text-transform: uppercase;
  font-size: 12px;
}
.searchClientText {
  width: 222px !important;
  height: 25px !important;
  border-radius: 3px;
}
.checkboxList {
  margin: 0 0 -1em;
  padding: 0;
}
.checkboxList li {
  list-style: none;
  padding-bottom: 1em;
}
td {
  width: 150px;
  vertical-align: top;
}
<!DOCTYPE html>
<html>

<head>
  <link rel="stylesheet" href="http://ift.tt/2d5XRzf" />
  <link rel="stylesheet" href="http://ift.tt/2dyIO3I" />
  <script src="http://ift.tt/ZnjyAz"></script>
  <script src="http://ift.tt/2dyGzxD"></script>

  <script src="http://ift.tt/ZnjyAz"></script>
  <script src="http://ift.tt/2d5VZqi"></script>

  <meta charset=utf-8 />
  <title>JS Bin</title>
</head>

<body>
  <div class="demo-section k-content">
    <ul id="fieldlist">
      <li>
        <input id="checklist" class="k-input searchClientText" type="text" placeholder=51-56 style="height:auto;" />
        <button class="k-button k-primary" id="get">check</button>
      </li>
    </ul>
    <table>
      <tr>
        <td>
          <div id="treeview"></div>
          <div id="result"></div>
        </td>
      </tr>
    </table>

  </div>
  <div id="checklist">

  </div>




</body>

</html>



Toggle background color of checkbox div or label

I can get the follow code to work like I want it to with one exception. When I select the checkbox the background color of the div changes from #fff to #ffe600 as it should. The problem I'm running into is when the form is submitted and page is refreshed the background color reverts back to #fff. I would like for the back ground color to stay #ffe600 when the page is refreshed after the form has been submitted. The checkbox remains checked after page refresh but the div background color reverts back to #fff. Does anyone know if it's possible to maintain the div background color #ffe600 when the page is refreshed. This has really gotten be stumped.

function myFunction(x, _this) {
  if (_this.checked) {
    x.style.backgroundColor = '#ffe600';
  } else  {
    x.style.backgroundColor = '#fff';
  }
}
#product1 {
  background-color: #fff;
  padding: 3px 5px 3px 7px;
  margin-top: 6px;
}
<script src="http://ift.tt/1oMJErh"></script>
<div id="product1">
  <label class="chk">
    <input type="checkbox" onChange="myFunction(product1, this)" name="select_product" value="Y" />Label goes here.</label>
</div>

Thanks!