jeudi 30 novembre 2017

Not able to remove values from array after uncheck in checkboxes

I have a requirement where all the checked values in checkboxes should be displayed in a textarea. This part works perfectly fine,but the problem occurs when i uncheck the checkbox unchecked element is not getting removed from the array. i have used jquery each function as shown within double quotes.

"$("input:checkbox[name=category]:checked").each(function(){"

As per my understanding,the above function will check for only checked values and updates into the array,so if any value is unchecked and this function is called,the unchecked value should be removed isn't it?

var pc = [];
function check(){
$("input:checkbox[name=category]:checked").each(function(){
             pc.push(decodeURI($(this).val()));
    });
         pc = $.unique(pc);
    document.getElementById("result").value = pc.join("\n");
}
<script src="http://ift.tt/1qRgvOJ"></script>
<body onload ="check()">
<input type="checkbox" name="category" value="a/b" onclick="check()" checked>
<input type="checkbox" name="category" value="c/d" onclick="check()" checked>
<input type="checkbox" name="category" value="e/f" onclick="check()" checked>
<input type="checkbox" name="category" value="g/h" onclick="check()" >

<textarea id="result"></textarea>

The above snippet highlights the issue,where if i uncheck any checkbox,the value is not getting removed from array. Please correct me if i am doing anything wrong? Please help me! Thanks in advance




Android ListView - Unclickable Checkbox

I am hoping someone has seen this problem before. I have a listview where all the elements have a checkbox. This all works well, except that there is one checkbox that is unselectable (can't check and uncheck it). It isn't the first item in the list, and the problem isn't there on all devices. Works fine on a Samsung S3, but has a problem on the Nexus 6P.

After some investigating I turned on 'Show layout bounds' in the developer options. This is where I saw something very interesting, the unclickable element didn't draw any bounds. In the example below the checkbox for 'Bar Tunes' is unselectable.

Layout Bounds

Does anyone have an idea why this might be happening. Here is the layout file.

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

<LinearLayout xmlns:android="http://ift.tt/nIICcg"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingRight="@dimen/list_10sp"
    android:gravity="center_vertical"
    android:id="@+id/listRow"
    android:background="@color/GreyLight">

    <FrameLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content">
        <CheckBox
            android:layout_width="@dimen/list_40sp"
            android:layout_height="@dimen/list_40sp"
            android:layout_marginLeft="@dimen/list_5sp"
            android:checked="true"
            android:id="@+id/selectedCheckbox"
            android:button="@drawable/button_checkbox_image"
            android:layout_gravity="center_vertical"/>

        <ImageView
            android:id="@+id/connectedIcon"
            android:src="@drawable/tick_raw"
            android:adjustViewBounds="true"
            android:layout_width="@dimen/list_20sp"
            android:layout_height="@dimen/list_20sp"
            android:layout_marginLeft="@dimen/list_20sp"/>

    </FrameLayout>

    <LinearLayout
        android:orientation="horizontal"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:id="@+id/textBackground">

        <LinearLayout
            android:orientation="vertical"
            android:layout_width="0dp"
            android:layout_weight="1"
            android:paddingRight="@dimen/list_10sp"
            android:paddingTop="@dimen/list_5sp"
            android:paddingBottom="@dimen/list_5sp"
            android:clickable="true"
            android:id="@+id/searchList"
            android:background="@drawable/button_list_item"
            android:layout_height="wrap_content">

            <com.hdms.manager.Drawable.NightlifeTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="List Name"
                android:textSize="@dimen/list_text_size"
                android:textStyle="bold"
                android:id="@+id/listName"
                android:singleLine="true"
                android:ellipsize="middle"/>

            <com.hdms.manager.Drawable.NightlifeTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/playlist_neg_2sp"
                android:text="(User Friendly Name)"
                android:textSize="@dimen/playlist_text_size"
                android:singleLine="true"
                android:id="@+id/friendlyName" />

            <com.hdms.manager.Drawable.NightlifeTextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="List Description"
                android:textSize="@dimen/list_text_size_smaller"
                android:singleLine="true"
                android:id="@+id/listDescription" />
        </LinearLayout>

        <ImageButton
            android:layout_width="@dimen/playlist_40sp"
            android:layout_height="@dimen/playlist_40sp"
            android:padding="@dimen/account_2sp"
            android:layout_marginLeft="@dimen/account_5sp"
            android:layout_gravity="center"
            android:visibility="gone"
            android:scaleType="fitCenter"
            android:id="@+id/crowdDJButton"
            android:src="@drawable/crowddj_icon"
            android:background="@drawable/button_background_green"/>

        <ImageButton
            android:layout_width="@dimen/playlist_40sp"
            android:layout_height="@dimen/playlist_40sp"
            android:src="@drawable/icon_nm"
            android:layout_gravity="center"
            android:visibility="gone"
            android:layout_marginLeft="@dimen/account_5sp"
            android:scaleType="fitCenter"
            android:tint="@color/White"
            android:background="@drawable/button_background_green"
            android:padding="@dimen/account_2sp"
            android:id="@+id/musicSystemButton"/>

        <ImageView
            android:layout_width="@dimen/playlist_20sp"
            android:layout_height="@dimen/playlist_20sp"
            android:padding="@dimen/playlist_2sp"
            android:layout_marginRight="@dimen/player_5sp"
            android:layout_gravity="center_vertical"
            android:visibility="gone"
            android:id="@+id/crowdDJSearchable"
            android:background="@color/StormGreen"
            android:src="@drawable/crowddj_icon"/>

        <com.hdms.manager.Drawable.NightlifeTextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:textColor="@color/White"
            android:text="0"
            android:textSize="@dimen/list_text_size_smaller"
            android:minWidth="@dimen/list_45sp"
            android:minHeight="@dimen/list_25sp"
            android:singleLine="true"
            android:ellipsize="marquee"
            android:id="@+id/songCount"
            android:layout_gravity="center_vertical"
            android:background="@drawable/border_rounded_darkgrey"/>

        <ImageView
            android:id="@+id/dot"
            android:src="@drawable/dot_dot_dot"
            android:adjustViewBounds="true"
            android:visibility="gone"
            android:layout_gravity="center_vertical"
            android:layout_marginRight="@dimen/account_10sp"
            android:layout_width="@dimen/list_20sp"
            android:layout_height="@dimen/list_20sp"/>

    </LinearLayout>

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="@dimen/list_1sp"
        android:background="@drawable/verticalline"/>
</LinearLayout>

Any suggestions for how to fix or track down this problem? Thanks




Click div to toggle inner checkbox

I have a DataList with an ItemTemplate inside of it which creates the following ui:

ui

snippet:

    <asp:DataList ID="DataList1" runat="server" RepeatColumns="5" RepeatDirection="Horizontal" DataKeyField="Key">

            <ItemTemplate>
                <div id="Row">
                    <div id="Cell">
                        <div id="Permission_Label_Div">
                            <asp:Label runat="server" ID="Permission_Label" Text='<%# Eval("Key") %>'></asp:Label>
                        </div>

                        <div id="Permission_CheckBox_Div">
                            <asp:CheckBox runat="server" AutoPostBack="true" ID="Permission_CheckBox" Checked='<%# Eval("Value") %>' />
                        </div>
                    </div>
                </div>
            </ItemTemplate>

        </asp:DataList>

What I'm having trouble doing is allowing the user to toggle the check boxes by clicking on its respective div.I'm assuming since the DataList is an asp server control, I would have to wait for the page to finish loading before I can access each DataList item. Any help would be appreciated.




Set checkbox to be checked if input value =

I have an input and a checkbox. I have managed to change the value in the input on clicking the checkbox, and un clicking etc which works fine.

I'm looking to auto set the checkbox to be checked on pageload, if the input value = yes.

HTML

<input type="text" value = "yes" id ="inputId">
<input type="checkbox" id = "yourCheckboxId">

JQUERY

$('#yourCheckboxId').click(function() {
        if ($('#yourCheckboxId').is(':checked')){
             $('#inputId').val('yes');
        }    
        if (!$('#yourCheckboxId').is(':checked')){
             $('#inputId').val('no');
        }     
});

You'll notice that even though the value in the input is set to yes, on page load, the checkbox isn't checked. This is what I have so far, see jsfiddle here: http://ift.tt/2zT44wG

Thanks




Javascript checkbox sum

I have this assignment that I'm supposed to make an "Order" page with a form and items in the checkbox format. I wrote a function in javascript to add the values of the marked checkboxes together and return me a total. It was working fine yesterday, but I might have done something yesterday without noticing and it is not adding the values anymore.

Here is the function:

function totalIt() {
  var input = document.getElementsByName("product");
  var total = 0;
  for (var i = 0; i < input.length; i++) {
    if (input[i].checked) {
      total += parseFloat(input[i].value);
    }
  }
  document.getElementByName("total").value = "$" + total.toFixed(2);
}
Select your items:
<br>
<input name="product" value="3.65" type="checkbox" onclick="totalIt()" /> Item 1 - $3.65
<br>
<input name="product" value="5.50" type="checkbox" onclick="totalIt()" /> Item 2 - $5.50
<br>
<input name="product" value="3.29" type="checkbox" onclick="totalIt()" /> Item 3 - $3.29
<br>
<input name="product" value="7.99" type="checkbox" onclick="totalIt()" /> Item 4 - $7.99<br>
<input name="product" value="5.45" type="checkbox" onclick="totalIt()" /> Item 5 - $5.45<br>
<input name="product" value="99.99" type="checkbox" onclick="totalIt()" /> Item 6 - $99.99<br>
<input name="product" value="30.00" type="checkbox" onclick="totalIt()" /> Item 7 - $30.00
<br> Total:
<br>
<input value="$0.00" readonly="readonly" type="text" name="total" />

Am I not seeing something?




Adding a "if" "then" checkbutton

I am new to coding and I wrote some code for a calculator I use to solve some stuff at work.

I am now stuck trying to add check buttons for "feet" & "meters". I want them to integrate into my equation, that way I wont have to convert them manually beforehand. I will add the second equation for feet once I can figure out how to make them toggle between the two.

Here is my code so far.

import Tkinter
import math
from Tkinter import *


Lreq = 105
Dref = 1

class compintapp_tk(Tkinter.Tk):
zdef __init__(self,parent):
    Tkinter.Tk.__init__(self,parent)
    self.parent = parent
    self.initialize()

def initialize(self):
    self.grid()
    self["bg"] = "grey"


    ## Title & subtitle labels ---------------------------------------
    titlelbl = Tkinter.Label(self, text="Wattage Calculator",
                          anchor="center",fg="black",bg="darkorange2")
    titlelbl.grid(column=0,row=0,columnspan=4,sticky='EW')




    ## Input Labels --------------------------------------------------

    sensitivitylbl = Tkinter.Label(self, text="Loudspeaker sensitivity?",
                          anchor="w",fg="white",bg="SlateGray4")
    sensitivitylbl.grid(column=0,row=2,columnspan=3,sticky='EW')

    distancelbl = Tkinter.Label(self, text="Distance from speaker to listening position?",
                          anchor="w",fg="white",bg="SlateGray4")
    distancelbl.grid(column=0,row=3,columnspan=3,sticky='EW')

    headroomlbl = Tkinter.Label(self, text="How much headroom for amplifier?",
                          anchor="w",fg="white",bg="SlateGray4")
    headroomlbl.grid(column=0,row=4,columnspan=3,sticky='EW')


    wattagelbl = Tkinter.Label(self, text="Total Wattage :",
                          anchor="w",fg="white",bg="SlateGray4")
    wattagelbl.grid(column=0,row=7,columnspan=3,sticky='EW')



    ## end of input labels ------------------------------------------------

    ## Input Boxes --------------------------------------------------------
    #self.sensitivity = Tkinter.DoubleVar()
    #speakersensitivity = Tkinter.Entry(self,textvariable=self.sensitivity)
    #speakersensitivity.grid(column=1,row=2,sticky='EW')

    self.sensitivity = Tkinter.DoubleVar()
    speakersensitivity = Tkinter.Entry(self,textvariable=self.sensitivity)
    speakersensitivity.grid(column=3,row=2,sticky='EW')

    self.distance = Tkinter.DoubleVar()
    spkdistance = Tkinter.Entry(self,textvariable=self.distance)
    spkdistance.grid(column=3,row=3,sticky='EW')

    self.headroom = Tkinter.IntVar()
    spkheadroom = Tkinter.Entry(self,textvariable=self.headroom)
    spkheadroom.grid(column=3,row=4, sticky='EW')


    ## end of input boxes -------------------------------------------------

    ## Button
    button = Tkinter.Button(self,text="C A L C U L A T E",
                            anchor="w",fg="black",bg="green",
                            command=self.OnButtonClick)
    button.grid(column=0,row=6,columnspan=1)




    var = BooleanVar()

    c=Checkbutton(self, text="Meters", variable=BooleanVar(),
                  anchor="center",fg="white",bg="grey25")
    c.grid(column=2,row=6,columnspan=1)

    c=Checkbutton(self, text="Feet", variable=BooleanVar(),
                  anchor="center",fg="white",bg="grey25")
    c.grid(column=3,row=6,columnspan=1)




    # initialize global variables
    self.ckbuttonstatus = BooleanVar()



    ## end of button

    ## Output labels
    self.amt = Tkinter.StringVar()
    amtout = Tkinter.Label(self,textvariable=self.amt,
                          anchor="e",fg="red",bg="gold")
    amtout.grid(column=3,row=7,columnspan=1,sticky='EW')

    ## end of output labels -----------------------------------------------

    self.grid_columnconfigure(0,weight=2)
    self.resizable(0,0)


def OnButtonClick(self):
    Lsens = self.sensitivity.get()
    D2 = self.distance.get()
    HR = self.headroom.get()


    exponent = (Lreq-Lsens+20 * math.log10(D2/1)+HR)/10
    amount = 10 ** exponent
    self.amt.set(amount)

if __name__ == "__main__":
app = compintapp_tk(None)
app.title('Wattage Calculator')
app.mainloop()

I hope you all can help because I am having a really hard time finding anything on this.

Thank you,

DiFino




My checkbox list is not filled with the correspondant value

I have 2 arraylist filled on the java side : One with a full list of Nature : allNature and another one with the selected one on the java side natures. How can I check the natures in the full allNatures list ?

Here is my html code :

<div th:each="nature : ${allNature}" class="checkbox">
    <label > 
     <input type="checkbox" th:field="*{natures}" th:value="${nature.nom}" class="checkboxNature" />
         <span th:text="${nature.nom}">...</span>
       <span th:text="${nature.routage.nomRoutage}" >...</span>
    </label>
</div>

and the relevant (to me) java code in my controller :

@Controller
@SessionAttributes(value = "topologie", types = { Topologie.class })
@RequestMapping("/bus/topologie")
public class TopologieController {
    @ModelAttribute("allNature")
    public List<Nature> getAllNatures(final Topologie topologie)
            throws Exception {
        LOGGER.info("ModelAttribute to get all Nature for Cadre : {}",
                topologie.getCadre());
        return natureService.getNaturesByVersionCadre(topologie.getCadre(),
                topologie.getVersionCadre());
    }

and the object reference

public class Topologie {
    private List<Nature> natures = new ArrayList<Nature>();




AngularJs- Checkbox issue in safari

I have a checkbox and dropdown. When I set checkbox to true and select an option from dropdown, checkbox clears itself.

In other browsers code is working fine but showing this strange behavior in safari.

    Below is my html and js:

    <div class="form-group">
               <div class="col-md-12">
                    <div class="col-md-3">
                      <span ng-repeat="bRelation in Relations|limitTo: 3">
                      <label class="checkbox" for="">
                          <input type="checkbox" class="b-relation" ng-model="group" value="" ng-change="checkRelation(bRelation.Id)" name="group" id="" />
                          
                          <select class="form-control brelationnum" name="brelationnum" style="display:inline;">
                            <option value="">-- Relatives Count --</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                          </select>
                      </label>
                      </span>
                    </div>
                </div>
          </div>

$scope.Relations = [
    {'Id' : '1', 'Text' : 'Grandmother' },
    {'Id' : '2', 'Text' : 'Mother' },
    {'Id' : '3', 'Text' : 'Sister' }
];

I have created a Pluker here: Checkbox issue in safari

Can someone help me with the issue?




Change the value of the class which are all showing in list on selecting the checkbox

I have three checkbox (All, Selected, Un-Selected). If i select 'ALL' checkbox it will show all the menu. When I select 'SELECTED' checkbox it will show only the menu which was selected 'UNSELECTED' checkbox will show only the menu which i was not selected. I also have SELECTALL checkbox which should select only the displaying menu that was showing when we select any of three checkbox. I had written the function for the All, Selected, Un-selected to show the menu when I select. But I can't select the particular menus which was showing by selecting the SELECTALL check box. please resolve my problem. Thanks in advance.

$("#selectAll").click(function() {
  if($("#All").is(':checked')){
    $('.MenuClass').prop('checked',true);
    $('.MenuHidden').val('Y');
  }
  else if($("#Selected").is(':checked')){
    if($('#Menu).css('display') == 'none'){
      $('.MenuClass').prop('checked',true);
      $('.MenuHidden').val('Y');
    }
  }
  else if($("#UnSelected").is(':checked')){
    if($('#Menu).css('display') == 'none'){
      $('.MenuClass').prop('checked',true);
      $('.MenuHidden').val('Y');
    }
  }
}



Set value of ion-input to null when ion-checkbox is unchecked without [(ngModel)] angular 2 ionic 2

I want to empty ion-input value when I uncheck ion-checkbox.

<ion-item>
    <ion-label class = "Price">Fixed Price
        <ion-checkbox #FixedPrice></ion-checkbox>
    </ion-label>
</ion-item>
<ion-item>
    //I want to do something like that.
    <ion-input [value = ""]  = "!FixedPrice.checked"></ion-input>
    // i.e when I uncheck the ion-checkbox it should set the value of ion-input to "".
</ion-item>

If you need something else let me know.




mercredi 29 novembre 2017

React-native 0.49 CheckBox How to change the prop : value ?

I'm trying to understand how to change the value of a checkbox that is new in React-native 0.49.

            <CheckBox
            value = {this.state.value}
            onValueChange= {(value) => this.toggleCheckBox(value)}
            />

And this is my toggleCheckbox function

toggleCheckBox(data){
   this.setProps({
     value : data
});

The question is .. the function onValueChange only works once and once only. the toggleCheckBox is called only once also I cant figure out how to update the value of checkbox.




Accessing and comparing web.config variable values in an ASPX page

I have an appSetting variable in web.config configured as follows :

<add key="AllowMail" value ="true"/>

In my UI, I have a checkbox "Notify Me".

Now I want this checkbox to be rendered only when the AllowMail is configured as "true" or else I don't want this checkbox to be rendered/visible in the UI at all.

So how can I put such check in my ASPX page itself?

Checkbox code is as follows :

<asp:CheckBox ID="NotifyChkBx" runat="server" Text="Notify Me" />




How to Create a Simple Userform with Checkboxes in VBA

I am extremely new to VBA and am trying to create a spreadsheet that uses a checkbox userform to populate a table in a spreadsheet. I have been able to get the table to populate, but if a box is accidentally checked and is unchecked, the table remains populated. How do I get the table to go back to being blank after a box is unchecked and what is an efficient way to code the 33 checkboxes to populate the 33 spaces in the spreadsheet. Please see the images attached to aid in my description.

Thanks,

Userform Image
enter image description here

Spreadsheet Image
enter image description here




How to add checkbox in datagrid with easyui

IN my project, I choose easyui struction.

And CheckBox Selection on DataGrid is in this project.

The official website of EasyUI demo is using url:'datagrid_data1.json', but my date is from database.

$fileN=array();
$sql="select name from OA where sysNum='TZ201711201223';";
$sel=$conn->query($sql);
$row=$sel->fetchAll(PDO::FETCH_ASSOC);

for($i=0;$i<$rowNum;$i++)
{
    $fileN[$i]=$row[$i]['name'];
}

I want to set these value of array fileN to My DataGrid:

echo '<tr>
      <td style="width:10%" colspan="2">attachment</td>
      <td style="width:90%" colspan="18">
         <table  class="easyui-datagrid" title="" style="width:100%" data-options="rownumbers:true,singleSelect:true">
           <thead>
             <tr>
              <th data-options="field:\'ck\',width:5%,checkbox:true"></th>
              <th data-options="field:\'status\',width:85%,align:\'center\'">filename</th>
             </tr>
          </thead>';
     if($rowNum)
     {
       for($i=0;$i<$rowNum;$i++)
       {    
        echo '<tr>   
        <td style="width:5%" colspan="1"><input type="checkbox" >1</td>
        <td style="width:85%" colspan="17"><input style="width:99%"  value="'.$fileN[$i].'"></td>
        </tr>';
       }
     }
       echo '</table>';
      echo '</td>';
    echo  '</tr>';

The value of $rowNum is tag to sign whether have data or not.

$sql="select name from OA where sysNum='TZ201711201223';";
$sel=$conn->query($sql);
$row=$sel->fetch(PDO::FETCH_NUM);
$rowNum=$row[0];

I found it worked fail. I hava no idea about checkbox selection in table.Who can help me?




progressBar with 5 checkbox

I need progressBar to load the percentage of how many checkboxes are checked.

I tried to use it for 5 checkbox:

"progressbar.setProgress (20)" if it was checked, and if it was not "progressbar.setProgress (-20)"

The progressBar loads only "20%" even if the 5 checkboxes are checked.Can someone help me?




Count Checkboxes using JQuery. Not Working

I have a table with some checkboxes and I need to make a count every time 1 is selected. I have 2 lines and I have to count each line separately.

Here are the checkboxes:

{!! Form::checkbox('dente[]', $dente->id, null, ['class'=>'denteCheck-up'] ) !!}

{!! Form::checkbox('dente[]', $dente->id, null, ['class'=>'denteCheck-down'] ) !!}

The goal is always that 1 is selected it counts in real time and puts the result here:

<td id="count_dentes_up"></td>

<td id="count_dentes_down"></td>

For this and thanks to the help of a user of this community, I am using the following jquery code:

$('.denteCheck-up').change(function() {
  $('#count_dentes_up').text($('.denteCheck-up:checked').length);
});

$('.denteCheck-down').change(function() {
  $('#count_dentes_down').text($('.denteCheck-down:checked').length);
});

The problem is that in code snippets it works wonderfully but I can not get it to work at all. To help I'm using Laravel 5.4 and I'm incorporating the following scripts:

    

    
    <script src="http://ift.tt/2nfkus0" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="http://ift.tt/2zAEitV" integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
    <script src="http://ift.tt/2iF8Hmw" integrity="sha384-alpBpkh1PFOepccYVYDB4do5UnbKysX5WZXm3XxPqe5iKTfUKjNkCk9SaVuEZflJ" crossorigin="anonymous"></script>

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

    
    <script src=""></script>

    
    <script src=""></script>

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




How to count checkboxes using jQuery?

I'm doing a dashboard in Laravel 5.4, and I have a table with several checkboxes. I need to count each time 1 is selected and show the result on the side.

Basically I have to count in real time. And I have 2 lines, I have to count them separately, so I have separate classes

I've tried some things but nothing works.

Thanks in advance for help and ideas on how I can do this, below I leave the code of my checkbox.

{!! Form::checkbox('dente[]', $dente->id, null, ['class'=>'denteCheck-up'] ) !!}

{!! Form::checkbox('dente[]', $dente->id, null, ['class'=>'denteCheck-down'] ) !!}

In jquery, I've tried +/- this

$('.denteCheck-up').change(function(){ });

$('.denteCheck-down').change(function(){ });

I'm trying to get the result to appear here

<td id="count_dentes_up"></td>

<td id="count_dentes_down"></td>




Prevent checking others checbox if textarea is empty

A form with some textareas and a sumbit button are all disabled, each of textarea has a checkbox aside.

When checkbox is checked:

1- A message shows (You should not let activated textarea empty)

2- Submit button remains disabled

3- When start writing message hides and button enable.

When checkbox is unchecked :

1- message hides

2- textarea related to it is cleared if it has some texts

3-button returns to disabled

Everything is perfect so far with my codes below. Now, how can i prevent from checking others checkboxes if there is already one that is already checked with an empty textarea ? The logic is if a textarea is enabled it must receive text.

 //html part

//handling checkbox
$('input:checkbox').change(function() {
  if ($(this).prop('checked')) {
    $(".textareaalert").text("Don't let this activated textarea empty");
    $(".textareaalert").slideDown("slow");
    $("#submit").prop("disabled", true);
  } else {
    $(".textareaalert").slideUp("slow");
    $("#submit").prop("disabled", true);
    $("textarea").val('');

  }
});
//handling textarea
$("textarea").keyup(function() {
  var textareaLength = $(this).val().length;
  if (textareaLength == 0) {
    $(".textareaalert").text("Don't let this activated textarea empty");
    $(".textareaalert").slideDown("slow");
    $("#submit").prop("disabled", true);
  } else {
    $(".textareaalert").slideUp("slow");
    $("#submit").prop("disabled", false);
  }
});
<script src="http://ift.tt/1oMJErh"></script>
<div class="textareaalert" style="display:none"></div>
<form class="horizontal">
  <div class="form-group">
    <label>Infancia</label>
    <div class="col-md-9">
      <textarea class="form-control" id="infancia" disabled></textarea>
    </div>
    <div class="col-md-2">
      <input type="checkbox"> <label>Activo</label>
    </div>
  </div>
  // more text area below
</form>



Using ISSET with checkboxes

I am working on a wordpress search form to refine the current search and what Im trying to do is have the search results page with the search from and it's values set based on the query.

So far I've been successful in doing so with single select drop downs and single checkboxes like so --

<!-- SINGLE SELECT -->
    <select name="baths" class="form-control">
    <?php if (isset($_GET['baths'])) {
        $bths = $_GET['baths']; ?>
    <option value="<?php echo $bths; ?>"><?php echo $bths; ?></option>  
    <?php } else { ?>
    <option value="Any">Any</option>
    <?php } ?>
    <option value="Any">Any</option>
    <option value="1">1+</option>
    <option value="2">2+</option>
    <option value="3">3+</option>
    <option value="4">4+</option>
    <option value="5">5+</option>
    <option value="6">6+</option>
    <option value="7">7+</option>
    <option value="8">8+</option>
    <option value="9">9+</option>
    <option value="10">10+</option>
    </select>

<!-- SINGLE CHECKBOX -->
<input type="checkbox" name="dogs" class="styled" value ="yes" <?php if (isset($_GET['dogs'])) { ?>checked<?php } ?>>

That works, but for the multiple values it doesn't. This is my function to generate a set of checkboxes to select amenities -

<?php
$amenity_array = array();
$id            = get_query_var('site');
if (!empty($id)) {
  $property_amenities = get_post_meta($id, 'imic_property_amenities', true);
  global $imic_options;
  foreach ($property_amenities as $properties_amenities_temp) {
    if ($properties_amenities_temp != 'Not Selected') {
      array_push($amenity_array, $properties_amenities_temp);
    }
  }
}
global $imic_options;
if (isset($imic_options['properties_amenities']) && count($imic_options['properties_amenities']) > 1) {
  foreach ($imic_options['properties_amenities'] as $properties_amenities) {
    $am_name = strtolower(str_replace(' ', '', $properties_amenities));
    $check   = '';
    if (in_array($properties_amenities, $amenity_array)) {
      $check = 'checked="checked"';
    }

<!-- HERE I TRY TO FIND THE SELECTED CHECKBOXES AND CHECK THEM OFF -->
    if (isset($_GET['p_am'])) {
      $ams = $_GET['p_am'];

      echo '<div class="checkbox"><input type="checkbox" name="p_am" ' . $check . ' class="styled" value ="' . $properties_amenities . '"><label for="' . $am_name . '">' . $properties_amenities . '</label></div>';
    } else {
      echo '<div class="checkbox"><input type="checkbox" name="p_am" ' . $check . ' class="styled" value ="' . $properties_amenities . '"><label for="' . $am_name . '">' . $properties_amenities . '</label></div>';
    }
<!-- END ISSET -->

  }
} else {
  _e('There is no Properties Amenities', 'framework');
}
?>

For the multi select drop down I am using bootstrap multiselect, so on my template the code looks like this --

<select name="property_type[]" id="pt-multi" class="form-control multi-select2" multiple="multiple">
<?php
$terms = get_terms( "property-type", array( 'hide_empty' => 0 ) );
 $count = count($terms);
 if ( $count > 0  ){
echo "<option value='Any'>All</option>";
     foreach ( $terms as $term ) {
         echo "<option value='" . $term->slug . "'>" . $term->name . "</option>";
     }
 }
?>
</select>

On the page it renders out as ---

<select name="property_type[]" id="pt-multi" class="form-control multi-select2 iOSselect" multiple="multiple" style="display: none;">
<option value="Any">All</option>
<option value="co-op">Co-Op</option>
<option value="condo">Condo</option>
</select>

<div class="btn-group" style="width: 100%;">
<button type="button" class="multiselect dropdown-toggle btn btn-default form-control multi-select2" data-toggle="dropdown" title="Property Type" style="width: 100%; overflow: hidden; text-overflow: ellipsis;">
<span class="multiselect-selected-text">Property Type</span> 
<b class="caret"></b></button>
<ul class="multiselect-container dropdown-menu pull-right">
<li class="multiselect-item multiselect-all">
<a tabindex="0" class="multiselect-all">
<label class="checkbox"><input type="checkbox" value="multiselect-all">  Select all</label>
</a></li>
<li>
<a tabindex="0"><label class="checkbox">
<input type="checkbox" value="Any"> All</label>
</a></li>
<li>
<a tabindex="0"><label class="checkbox"><input type="checkbox" value="co-op"> Co-Op</label>
</a>
</li>
<li>
<a tabindex="0"><label class="checkbox"><input type="checkbox" value="condo"> Condo</label>
</a>
</li>
</ul>
</div>

Any ideas?




WPF Set GroupBox opacity to 60 percent if a checkbox is ticked

Is there any way in XAML to bind the opacity of a GroupBox depending on if a checkbox is ticked or not?

For example, I want a GroupBox to be 100% opacity if the checkbox is ticked, otherwise it will be 60% opacity if the checkbox is un-ticked.

Can I use element binding to achieve this?

Thanks all.




Show/Hide message if textarea is empty or not

I have 4 textareas and a submit button that are disabled, aside each of textarea there is a checkbox to enable them.

When checkbox is checked:

1- A message shows (Don't let this activated textarea empty). 2- Submit button remains disabled. 3- When starting to write: message hides and submit button is enabled.

When checkbox is uncheked :

1- message hides,

2- textarea related to that checkbox is cleared

3- submit button returns to disabled.

With my codes below this works perfectly for only the first textarea. But for the others textareas i have only this problem:

1- When starting to write: message keeps showing and submit button remains disabled. How can i solve this ?

//Function that handle the checkbox
$('input:checkbox').change(function() {
if ($(this).prop('checked')) {
$(".textareaalert").text("Don't let this activated textarea empty");
 $(".textareaalert").slideDown("slow"); 
$("#submit").attr("disabled", "disabled");   
  } else {
    $(".textareaalert").slideUp("slow");
    $("#submit").attr("disabled", "disabled");
    $("textarea").val('');      
     }
 });

 //Function that handle the textarea
$("textarea").keyup(function(){
var textareaLength = $("textarea").val().length;
if ( textareaLength ==0 ) {
    $(".textareaalert").text("Don't let this activated textarea empty");
    $(".textareaalert").slideDown("slow");
    $("#submit").attr("disabled", "disabled");
} else {
    $(".textareaalert").slideUp("slow");
    $("#submit").removeAttr("disabled");
}
}); 




How can I get the value of a bootstrap4 checkbox?

I have the following checkbox:

<label class="custom-control custom-checkbox">
     <input type="checkbox" class="custom-control-input" id="modal_checkbox">
     <span class="custom-control-indicator"></span>
     <span class="custom-control-description">Do not show me this again.</span>
</label>

But I don't know how to get the value of the checkbox using jquery. I tried to get the attr or the prop of the above classes and ID but I get an "undefined"




Check/Uncheck all checkbox in group Vue.js

I have an Array of checkbox which already divided in to groups and I need to check all child checkbox if parent is checked and uncheck if parent is uncheck and then update all their state in Array. This wayyy over my head since I'm realy new to Vue.

I setup a Codepen here.

Js

let tree = [
    {
        "text": "AccountController",
        "id": 1,
        "state": {
            "opened": false,
            "selected": true,
            "disabled": false
        },
        "children": [
            {
                "text": "Index",
                "id": 2,
                "state": {
                    "opened": false,
                    "selected": true,
                    "disabled": false
                },
                "children": null
            },
            {
                "text": "Login",
                "id": 3,
                "state": {
                    "opened": false,
                    "selected": true,
                    "disabled": false
                },
                "children": null
            },
      ...
        ]
    },
    {
        "text": "BaseController",
        "id": 19,
        "state": {
            "opened": false,
            "selected": true,
            "disabled": false
        },
        "children": [
            {
                "text": "GetErrorListFromModelState",
                "id": 20,
                "state": {
                    "opened": false,
                    "selected": true,
                    "disabled": false
                },
                "children": null
            },
            {
                "text": "GetErrorFromModelState",
                "id": 21,
                "state": {
                    "opened": false,
                    "selected": true,
                    "disabled": false
                },
                "children": null
            },
      ...
        ]
    }
]
let app = new Vue({
    el : '#clone',
    data : {
        items : tree,

    },
    methods : {
        submitForm() {
            console.log(tree);
        }
    }
});

Html

<div id="clone">
    <button @click="submitForm">click</button>
    <div class="dd">
        <ol class="dd-list">
            <li v-for="(item, index) in items" 
                v-bind:class="[item.state.opened ? 'dd-item open' : 'dd-item']">
                <div class="dd-handle"
                     @click="item.state.opened = !item.state.opened">
                    <input type="checkbox"
                           :disabled="item.state.disabled" 
                           :name="item.text" 
                           :checked="item.state.selected" 
                           @click="item.state.selected = !item.state.selected">
                    <label :for="item.text"></label>
                </div>

                <ol v-if="item.children.length != 0" class="dd-list">
                    <li v-for="(children, index) in item.children" 
                        :data-id="children.id" class="dd-item">
                        <div class="dd-handle">
                            <input type="checkbox" 
                                   :name="children.text" 
                                   :checked="children.state.selected" 
                                   :disabled="children.state.disabled" 
                                   @click="children.state.selected = !children.state.selected">
                            <label :for="children.text"></label>
                        </div>
                    </li>
                </ol>
            </li>
        </ol>
    </div>
</div>

Can someone enlighten me please. Thank in advance!




Get toggle checkbox status is it true or Not

html code

<input type="checkbox" name="toggle" id="switch">
   <label for="switch">Toggle</label>

css

input[type=checkbox] {
    width: 0;
    height: 0;
    visibility: hidden;
}

label {
    cursor: pointer;
    text-indent: -9999px;
    width: 50px;
    height: 20px;
    background: grey;
    display: block;
    border-radius: 100px;
    position: relative;
}

label:after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 90px;
    transition: 0.3s;
}

input:checked + label {
    background: #bada55;
}

input:checked + label:after {
    left: calc(100% - 5px);
    transform: translateX(-100%);
}

label:active:after {
    width: 30px;
}

jquery script

$('input').on("change", function () {
    if ($('input[type="checkbox"].is(":checked")')) {
        alert("its checked");
    }
});

in this, i do not get a status of checkbox is it true or false I try my best I did not get any solution. when click on toggle its always give me a false value please help me.




Disable the checkbox based on value from the View bag Dynamically through Razor

I want the checkbox to generate the result similar to the following code, if the Value in the @ViewBag.Role is something other than "Unit Incharge":

@Html.CheckBoxFor(f => f.UnitInchargeSign_SDD, new { @disabled = "disabled" , @checked="checked"})`

How would i do it? How should i place the condition to disable it? I have seen other questions as well but I didn't understand how to place condition for my purpose.




How can i select all rows using pagesize on Kendo

I have checkbox which must select entire grid rows. Once a user click select all, It must select all pages on the grid.

Now i can get the length of the rows on the grid but only one checkbox get checked. How can i get all check box clicked since i can get the length?

Here is my code:

 function checkAll(ele)
    {

        var grid = $("#Grid1").data("kendoGrid");
        grid.dataSource.pageSize(grid.dataSource.data().length);
        console.log("Length" + grid.dataSource.data().length);

        var dataArea = gridElement.find(".k-grid-content");
        var gridTest = $('#Grid1 .checkbox');

        for (var i = 0; i < gridTest.length; i++) {
            var isChecked = $('#masterCheckBox').is(':checked')//!$(this).is(':checked');
            alert("isChecked" + isChecked);
            if (isChecked) {
                $('#Grid1.checkbox').prop('checked', 'checked');
                break;
            }
        };
    };

Kendo grid

<div>

            @(Html.Kendo().Grid<model>()
            .Name("Grid1")
                  .Columns(columns =>
                  {
                  columns.Bound(x => x.roleName).Title("Role Names");
                  columns.Template(@<text></text>).ClientTemplate("<input type='checkbox' #= selected ? checked='checked':'' # class='checkbox' />")
                                              .HeaderTemplate("<input type='checkbox' class='checkbox' id='masterCheckBox' onclick='checkAll(this)'/>")
                                              .Width(30);
                  })

                  .Pageable(pageable => pageable
                    .Refresh(true)
                    .PageSizes(true)
                    .ButtonCount(5))
                  .Scrollable()
                  .Filterable()
                  .Sortable()

                  .Resizable(resize => resize.Columns(true))
                  .DataSource(dataSource => dataSource
                  .Ajax()
                  .PageSize(10)
                  .ServerOperation(false)
                  .Read(read => read.Action("", ""))))


        </div>




Filtering search using checkboxes

I have a form that allows users to search my website. The site has different sections, each one corresponding to a custom post type (it's based on Wordpress), so I've added a filter where the user can check in which of the sections they want to search.

How can I detect which checkboxes have been ticked so that when the results page is loaded they are correctly filtered? Can I do it with $_POST or do I need a cookie?

I'm sure this is pretty simple but I have little experience with forms and posting values, so I need a little direction. Thank you for your help!




mardi 28 novembre 2017

Phaser.Cache.getImage: Key "texture" not found in Cache

create: function(){    

var checkbox1 = game.add.checkbox( 10, 10, { text: 'labeltext', style: { fill: '#ffffff' } }, 'texture' );

checkbox1.events.onInputUp.add( function( elm, pointer ){
  alert( checkbox1.state );
}, this );

}




How to use multiple rowspan & colspan with checkbox in gridview(asp.net)

i want gridview header

asp.net

*checkbox|header1|header2 |header3|

checkbox|header1|header2_1|header2_2|header3|

checkbox.rowspan=2  
header1.rowspan=2  
header2.colspan=2  
header3.rowspan=2  

How can i solve this?




Checked box is correct or not?

I have PHP form. This foreach is execute multiple checkedboxs. I want know, User selected checked boxs C_ID INSERT to the database. This code not working properly.

    <?php
 if(isset($_POST['send'])){
      foreach($_POST['mod'] as $checkbox){
        $checkbox = $values[COURSE_ID];
        echo $checkbox . ' ';

        $date = date("Y-m-d"); 
        $sql= "INSERT INTO REG ( C_ID, REGISTERED, DATE) "
        . "VALUES ('".$values[C_ID]."', 'Y' ,'".$date. "')";
        DBQuery($sql);  
      } 
 }

echo "<form name=send method=post >";
   foreach($result1 as $value) {
    $checked = in_array($value, $selected) ? 'checked="checked"' : '';
    echo '<input type="checkbox" name="mod[]" value="' . $value[C_ID] .'"  ' . $checked . '>'. $value[TITLE] .'</input><br>';
   }
   echo "<button type=submit id=send name=send>send</button>";
   echo "</form>";
   ?>




How can I count checkbox check from many forms

I want to count how many boxes checked. I am having trouble because it counts all the checkbox checks, but I want to count checkboxes from each arcticle and show it on there seprate boxesChecked div. article01 checks = boxesChecked-01,article02 checks = boxesChecked-02. I tried diffrent id's method to know where to innerhtml() count, but as you can see that dosent work

var form = $(".checkform");
var checkBoxes = $(form).children('.checkbox');
var count = 0;


$(checkBoxes).on('click', function() {
  var id = $(form).attr("id").split("-")[1]

  $.each(checkBoxes, function(i) {
    if (checkBoxes[i].checked) {
      count++;
    }
  });

  var divBoxesChecked = document.getElementById('boxesChecked-' + id);
  divBoxesChecked.innerHTML = 0;
  divBoxesChecked.innerHTML = count;
  count = 0;
});
/*CONTENT*/

.content01 {
  width: 69%;
}

.eventsbtn {
  color: #3f2916;
  outline: none;
  cursor: pointer;
  padding: 10px;
  margin-top: 40px;
  font-size: 26px;
  background: none;
  text-align: left;
  overflow: auto;
  width: 284px;
  border-radius: 3px;
  clear: both;
  margin-bottom: 0px;
  font-family: 'Crete Round', serif;
}

h2.events {
  padding: 18px;
}

#line {
  border-style: solid;
  border-bottom-width: 0px;
  border-color: #ffeb6b;
  margin-top: 0px;
  position: absolute;
  overflow: hidden;
  margin-top: 92px;
  width: 800px;
}

#line02 {
  border-style: solid;
  border-bottom-width: 0px;
  border-color: #ffeb6b;
  margin-top: 0px;
  position: absolute;
  overflow: hidden;
  margin-top: 18px;
  width: 800px;
}

.checkbox {
  display: flex;
  /*margin-bottom: 26px;*/
  /*float: left;*/
  cursor: pointer;
}

input[type='checkbox'] {
  /*margin-top: 32px;*/
  transform: scale(1.7);
  margin-right: 38px;
  /*position: absolute;*/
}

.article_block {
  clear: both;
  display: inline-block;
  float: left;
}

.article_title {
  overflow: hidden;
  margin-top: 0px;
  margin-bottom: 5px;
  margin-left: 20px;
}

.article_content {
  overflow: hidden;
  margin-top: 0px;
  margin-bottom: 0px;
  margin-left: 20px;
  width: 65%;
  font-size: 14px;
}

.content02 {
  overflow: hidden;
  margin-left: 36px;
}

.content02 img {
  float: left;
  margin-right: 20px;
}

.button01 {
  display: block;
  clear: both;
  text-align: center;
}

.button02 {
  display: block;
  clear: both;
  text-align: center;
}

.buttonDone {
  background-color: #a62300;
  width: 212px;
  height: 60px;
  color: white;
  font-size: 25px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 20px;
  margin-top: 70px;
  outline: none;
  font-family: arial;
  font-weight: 600;
}

.buttonClass {
  background-color: #a62300;
  width: 212px;
  height: 60px;
  color: white;
  font-weight: 600;
  font-family: arial;
  font-size: 25px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 0px;
  margin-top: 15px;
  outline: none;
}

.footer {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 3rem;
  background-color: #3b3530;
  text-align: left;
  font-size: 18px;
}

.footer_content {
  max-width: 1024px;
  margin: 0 auto;
  color: white;
  margin-top: 25px;
}

a {
  color: #ffe756;
}


/*POPUP*/

.button {
  font-size: 18px;
  /*padding: 10px;*/
  color: #ffe756;
  text-decoration: underline;
  cursor: pointer;
  transition: all 0.3s ease-out;
}

.popup h2 {
  color: #3f2916;
}

.popup p {
  margin-top: 0em;
  margin-bottom: 1em;
  font-family: 'rubik', sans-serif;
}

.overlay {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  transition: opacity 500ms;
  visibility: hidden;
  opacity: 0;
}

.overlay:target {
  visibility: visible;
  opacity: 1;
}

.popup {
  margin: 70px auto;
  padding: 20px;
  background: #fff;
  /*border-radius: 5px;*/
  width: 50%;
  position: relative;
  transition: all 5s ease-in-out;
}

.popup h2 {
  margin-top: 0;
  margin-bottom: 15px;
  color: #333;
  font-family: 'rubik', sans-serif;
}

.popup .close {
  position: absolute;
  top: 20px;
  right: 30px;
  transition: all 200ms;
  font-size: 30px;
  font-weight: bold;
  text-decoration: none;
  color: #333;
}

.popup .close:hover {
  color: #06D85F;
}

.popup .content {
  max-height: 30%;
  overflow: auto;
}
<script src="http://ift.tt/1oMJErh"></script>
<h3>ARTICLE1</h3>
<div id="boxesChecked-01"></div>

<div class="article01 panel">

  <form class="checkform" id="form-01">
    <input type="checkbox" id="box_01" class="checkbox" name="box_01" />
    <label class="checkbox"><div class="article_block"><div class="content02"><img src="article_img1.png"><h3 class="article_title">TEST1</h3><p class="article_content">1820: TEST</p></div></div></label>

    <input type="checkbox" id="box_02" class="checkbox" name="box_02" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img2.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_03" class="checkbox" name="box_03" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img3.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_04" class="checkbox" name="box_04" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img4.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_05" class="checkbox" name="box_05" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img5.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_06" class="checkbox" name="box_06" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img6.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_07" class="checkbox" name="box_07" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img7.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

  </form>


</div>
<h3>ARTICLE2</h3>
<div id="boxesChecked-02"></div>
<div class="article02 panel">

  <form class="checkform" id="form-02">
    <input type="checkbox" id="box_01" class="checkbox" name="box_01" />
    <label class="checkbox"><div class="article_block"><div class="content02"><img src="article_img1.png"><h3 class="article_title">TEST1</h3><p class="article_content">1820: TEST</p></div></div></label>

    <input type="checkbox" id="box_02" class="checkbox" name="box_02" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img2.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_03" class="checkbox" name="box_03" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img3.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_04" class="checkbox" name="box_04" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img4.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_05" class="checkbox" name="box_05" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img5.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_06" class="checkbox" name="box_06" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img6.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

    <input type="checkbox" id="box_07" class="checkbox" name="box_07" />
    <label class="checkbox"><div class="article_block" ><div class="content02"><img src="article_img7.png"><h3 class="article_title">TEST</h3><p class="article_content">TEST</p></div></div></label>

  </form>


</div>



Sending emails from a checkbox using php

Im trying to send street addresses to an email address using php from a checkbox form. For example I have 5 checkboxes. 1-4 are for actual values such as mouse, cat, dog, bird and then the fifth would be for all of them. Say someone clicks just on cat. I wanna be able to send someones street address to another email based on a previous form they filled out that asked for zip code and their new street address. I would have a database of emails to send to based on the zip code they gave me and also the email of pet shops that correlate with that zip code. So if someone filled out a form asking for their zip code along with their new address and then checked cat, I wanna be able to find the pet shop in a database that is closest to that zip code and have it send an email to that shop with the persons street address and other information. I know this is prob very complicated. If someone could point me in some direction or help me out that would be great. Thanks




CheckBox and EditText on ListView

i have some troubles with my LisView, on every item i have two checkBoxes, and one editText. Im working on an app for my restaurant so, every item in the list is a dish ordered, i'm correctly add items to the list, but when im write something on the editText or check the checkBoxes and then add a item to the list, the state of that containers erase, i have been searching for a method to do that, and some people tell me to create a class of the containers in the list, so i can save in the state, But i have no idea on how to do that im from Guatemala so my English is not very clear i think. But i would appreciate the help, THANKS!




Angular - inconsistent behaviour when programmatically checking checkboxes on ngOnInit

I have a form that I'm populating with information from the database when I pull a record, and part of the information I'm pulling is from what is a many to many relationship in the database, and in this particular case, for each record that exists, the appropriate checkbox gets checked.

What it bizarre for me, is that I can reload the page, and in some instances the checkboxes check, and others they do not. I suspect the asynchronous nature of javascript is to blame but I'm not sure. The following is the relevant code.

The ngOnInit method that initializes the form and if the change id exists, pulls the information from the database for that record through the getChange(id) method.

ngOnInit(): void {
// (initialize form and form groups.)...
this.sub = this.route.params.subscribe(
      params => {
        const id = +params['id'];
        this.getChange(id);
      }
    );
}

In this method I only included one of the relevant methods that call onChangeTypesReceived, which actually checks the boxes should the proper values be passed in.

getChange(id: number): void {   
    this.changeService.getChangeTypes(id)
      .subscribe(
      changeTypes => this.onChangeTypesRetrieved(changeTypes),
      (error: any) => this.errorMessage = <any>error
      );
}

Finally the method that checks the boxes and populates text fields based on whether the proper values are returned.

onChangeTypesRetrieved(changeTypes: any[]) {
    Array.from(changeTypes).forEach(changeType => {
      console.log('changeType: ' + changeType);
      if (changeType.TypeofChangeId === this.typeOfChangeEnum['SRV Package']) {
        this.changeForm.get('changeOverviewFG.srvCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.srvPackage').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['WKS Package']) {
        this.changeForm.get('changeOverviewFG.wksCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.wksPackage').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['GPO']) {
        this.changeForm.get('changeOverviewFG.gpoCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.gpo').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['AD']) {
        this.changeForm.get('changeOverviewFG.adCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.ad').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['Manual Fix']) {
        this.changeForm.get('changeOverviewFG.manualCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.manualFix').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['Network']) {
        this.changeForm.get('changeOverviewFG.networkCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.network').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['Hardware']) {
        this.changeForm.get('changeOverviewFG.hardwareCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.hardware').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['Infrastructure']) {
        this.changeForm.get('changeOverviewFG.infraCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.infrastructure').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['Vendor Supported']) {
        this.changeForm.get('changeOverviewFG.vendorCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.vendorSupported').patchValue(changeType.Description);
      } else if (changeType.TypeofChangeId === this.typeOfChangeEnum['Other']) {
        this.changeForm.get('changeOverviewFG.otherChangeCheck').patchValue(true);
        this.changeForm.get('changeOverviewFG.otherTypeOfChange').patchValue(changeType.Description);
      }
    })
  }

So I can refresh the page and only some of the time do the proper checkboxes actually check. So I am hoping someone might be able to tell me what I should include in my code to make sure this executes properly every time.

Thanks so much in advance!




Protractor - select checkbox if not selected

I try execute in protractor following scenario:
1. Find checkbox
2. Check if it is selected
- If yes - go further
- If not - select it and go further

For some reason isSelected() function is not working with my checkbox, but I've found some solution. Below code works correctly:

expect(checkbox.getAttribute('aria-checked')).toEqual('false')

It checks some checkbox attribute which is 'false' if not selected and 'true' if selected. (but as a string)

Now the main question. How to write an 'if / else' statement to make it works?

I tried something like that:

if (expect(checkbox.getAttribute('aria-checked')).toEqual('false')) {
 checkbox.click();
}

But it always clicks on checkbox no mater if it was selected or not. I've tried also:

if (checkbox.getAttribute('aria-checked').toEqual('false')) {
 checkbox.click();
} 

But there is an error which says "It's not a function".

Could anybody help me with that?




Checkbox values in prestashop

I'm working with prestashop and try to get value from a form with checkbox using a HelperForm

SO what I had is :

$fields_form[0]['form']= [
        'legend'=> [
            'title'=> $this->l('Indexation')
        ] ,
        'input'=>[
            [
                'type'=>'text',
                'label'=> $this->l('Base(s) à indexer'),
                'name'=>'options',
                'size'=>20,
                'required'=>true
            ]
        ],
        'submit'=>[
            'title' => $this->l('Save'),
            'class' => 'btn btn-default pull-right'
        ]
    ];

and then

$helper = new HelperForm();
[...]
$helper->toolbar_btn = array(
        'save' =>
            array(
                'desc' => $this->l('Save'),
                'href' => AdminController::$currentIndex.'&configure='.$this->name.'&save'.$this->name.
                    '&token='.Tools::getAdminTokenLite('AdminModules'),
            ),
        'back' => array(
            'href' => AdminController::$currentIndex.'&token='.Tools::getAdminTokenLite('AdminModules'),
            'desc' => $this->l('Back to list')
        )
    );

    // Load current value
    $helper->fields_value['options'] = Configuration::get('options');

    return $helper->generateForm($fields_form);

and in my getContent I had :

$my_module_name = strval(Tools::getValue('options'));
return $my_module_name;

So until there I had no problem. I write 'test' in the text input and then 'test' is returned but I don't want a text input I want a checkbox input so I changed my form for :

 $fields_form[0]['form']= [
        'legend'=> [
            'title'=> $this->l('Indexation')
        ] ,
        'input'=>[
            [
                'type'=>'checkbox',
                'label'=> $this->l('Base(s) à indexer'),
                'name'=>'options',
                'required'=>true,
                'values'=>[
                    'query'=>$options,
                    'id'=>'id',
                    'name'=>'name'
                ]
            ]
        ],
        'submit'=>[
            'title' => $this->l('Save'),
            'class' => 'btn btn-default pull-right'
        ]
    ];

and in my getContent(): return (Tools::getValue('options')); But with that, nothing is displayed.




Loop through checkbox and display the value of checkbox

I'm looping through multiple checkboxes and inside the loop I need to be able to display value of checboxes are checked.How to do that?

So far, this is my code:

$("input[type=submit]").click(function () {
   var answer = $("#SelectedAnswer").val();
   $("input:checked").each(function () {
      alert("Checkbox: " + answer);
   });
});

My checkbox is looping in table that hold the value

<table class="table" id="polo">
<thead>
    <tr>
        <th colspan=""></th>
        <%
        for(int a = 1; a < 4; a++){         
        %>
        <th>PO <%=a %></th>
        <%
        }
        %>
    </tr>
</thead>
<tbody>
    <%
        for(int i = 1; i < 4; i++){         
    %>
    <tr>
        <td id="loid">LO <%=i %></td>
        <%
        for(int x = 1; x < 4; x++){         
        %>
        <td id="sempo"><input type="checkbox" name="poid" id="poid" value="po <%=x %>" class="checkbox-primary"></td>
        <%
        }
        %>
    </tr>
    <%
        }
    %>
</tbody>

Sorry for the newb question. I'm kinda new to jquery.




Setting up checkboxes as custom user meta in user admin - WooCommerce

I set up a simple checkbox field in the user account admin interface. Here is how I am displaying/saving it:

function show_free_ground_field( $user ) { 
?>

    <h3>Free Ground Shipping</h3>

    <table class="form-table">

        <tr>
            <th>Free ground for order > $1000</th>

            <td>
                <?php
                woocommerce_form_field( 'freeGround', array(
                    'type'      => 'checkbox',
                    'class'     => array('input-checkbox'),
                    'label'     => __('Yes'),
                ), '' );


                ?>

            </td>
        </tr>

    </table>
<?php 
}
add_action( 'show_user_profile', 'show_free_ground_field' );
add_action( 'edit_user_profile', 'show_free_ground_field' );

function save_free_ground_field( $user_id ) {

    if ( !current_user_can( 'edit_user', $user_id ) ){
        return false;
    }
    if ( ! empty( $_POST['freeGround'] ) ){
        update_usermeta( $user_id, 'freeGround', $_POST['freeGround'] );
    }
}
add_action( 'personal_options_update', 'save_free_ground_field' );
add_action( 'edit_user_profile_update', 'save_free_ground_field' );

It displays fine, but if I check it off and re-visit the same user after saving the checkbox is unchecked. How do I fix that?




How to close popup after checkbox is checked

I'm in trouble trying to satisfate the specific request of a customer. I'm more a designer than a developer, so I need an urgent help.
I'm working on a Wordpress theme with a custom contact form integrated.
I need to place a link on the "Submit" button that when clicked will open a confirm popup. In the popup, the user would find a checkbox with a text saying "I declare that I have read, understood and accepted the information on the processing of my personal data".
Once they checkmark the checkbox, a "Continue" button on the bottom of that popup should enable (prior to checking the checkbox, the Continue button is disabled). When the Continue button is clicked, the popup would go away and the form will be launched.
I know it's a bit difficult, but I'm stucked and the customer really cares a lot about this thing.
Please, help! Every solution is fine.

Here's how I would like the popup to look like:
Popup preview png

Here's the HTML of the form:

<form method="post" name="contactform" class="peThemeContactForm">
                <div class="col-md-5 col-sm-5 col-xs-12 animated hiding" data-animation="slideInLeft">
                    <div class="form-group">
                        <input type="text" name="author" class="form-control input-lg" placeholder="<?php _e("Full Name",'Pixelentity Theme/Plugin'); ?>" required />
                    </div>
                    <div class="form-group">
                        <input type="email" name="email" class="form-control input-lg" placeholder="<?php _e("Email",'Pixelentity Theme/Plugin'); ?>" required />
                    </div>
                    <div class="form-group">
                        <input type="text" name="phone" class="form-control input-lg" placeholder="<?php _e("Phone",'Pixelentity Theme/Plugin'); ?>">
                    </div>
                </div>
                <div class="col-md-7 col-sm-7 col-xs-12 animated hiding" data-animation="slideInRight">
                    <div class="form-group">
                        <textarea name="message" class="form-control input-lg" placeholder="<?php _e("Message",'Pixelentity Theme/Plugin'); ?>" required ></textarea>
                    </div>
                </div>
                <input type="submit" class="btn btn-custom up animated hiding" value="<?php _e("Send Message",'Pixelentity Theme/Plugin'); ?>" data-animation="fadeInUpBig">
            </form>




Searching for a checkbox in the CheckBoxList VB.net

I have a Windows Form where i have a TextBox and I want to search for a particular checkbox in the CheckBoxList using the value in the textbox.




Dynamically change container when clicking radiobutton

I would like to change dynamically container after clicking on a radiobutton. I know I can do it easily using a ng-model and value. Here is a JSFiddle: http://ift.tt/2k6XLP2 It works fine when you have a small container or just some text. But how can I do that with a huge container stored in a scope ?

function MyCtrl($scope) {
    $scope.value[0]='<div>big container when clicking radiobutton 1</div>'
    $scope.value[1]='<div>big container when clicking radiobutton 2</div>'
    $scope.value[2]='<div>big container when clicking radiobutton 3</div>'
}

$scope.value[0] got the container of my radiobutton 1, $scope.value[1] got the container of my radiobutton 2 and $scope.value[2] got the container of my radiobutton 3.

What should the HTML be to do that dynamically ? (By 'dynamically' I mean clicking on a radiobutton changes the container as the example shown in the jsfiddle.)

Thank you a lot !




ionic - empty button because of a checkbox

Since a ngIf and a ngFor cannot cohabit, I put a ng-container to make the loop. But sinci I did that anything isn't working without any logic. Here is the code :

view

<ion-list *ngIf="listfavoris else loading">
    <ng-container *ngFor="let favoris of listfavoris">
      <button ion-item ion-long-press [interval]="500" (onPressing)="showModeCheckList(favoris)" (click)="openDocument(favoris)" *ngIf="favoris.shouldbedisplayed || ModeCheckList">
        <h2></h2>
        <h3></h3>
        <p *ngIf="favoris.Synchro == 1"><ion-icon name="sync" color="vert"></ion-icon> Dernière synchronisation le </p>
        <p *ngIf="favoris.Synchro == 0">Pas synchronisé</p>
        <ion-checkbox color="bleu" item-right [checked]="favoris.Checked" (ionChange)="toggleFavoris(favoris)"  *ngIf="ModeCheckList"></ion-checkbox>
      </button>
    </ng-container>
  </ion-list>

controller

    showModeCheckList(favoris:FavorisModel) {
        this.vibration.vibrate(100);
        this.ModeCheckList = true;
        this.toggleFavoris(favoris);
    }

    toggleFavoris(favoris: FavorisModel): void {
        favoris.Checked = !favoris.Checked;
        if (favoris.Checked) {
            this.NbFavorisSelect++;
        }
        else {
            this.NbFavorisSelect--;
        }
    }

Some buttons should be displayed at any time and some other should be displayed only in ModeCheckList.

  • If I let the code like that, buttons that should be displayed are always displayed correctly, but when I enter the ModeCheckList, the newly displayed buttons are empty (h2 not showing...) only an empty button with the checkbox appears

  • If I remove the checkbox completely, all elements are correctly displayed at any time (but I need the checkbox)

  • If I remove the ngif and put the ngfor in the button tag, the problem dissapears (but I need the ngif)

  • I cannot put ngif outside the ngfor because the test is about current loop element.

  • If I remove only the ngif from the checkbox, all elements are empty and when I enter the ModeChecklist, I get this error

    ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'

  • If I remove ngif and ion-change from the checkbox, all elements are always empty buttons

I don't understand anything, what's the problem with the checkbox ?




Is there a beforeChange event for checkbox in jQuery or JS?

Is there an event for a checkbox that triggers before checking?

I want to cache some data of siblings of checkbox which change on checkbox change.




lundi 27 novembre 2017

Need to get dynamic count of the selected check-boxes

I'm having the two types of check-boxes one is for selectAll check-box in the data table header, and another type selecting the check-box for each row.

I'm doing a operation, So I need to show the confirmation message, How do I get the count of the selected check-boxes from the Managed Bean.

My code was written in JSF 1.2.




Select Checkbox !== Select Row Table

The select/unselect button works on the checkbox.

But it does not work for the row table.

//Select row table
$('#example').on('click', 'tr', function() {
  var $row = $(this),
    isSelected = $row.hasClass('selected')
  $row.toggleClass('selected')
    .find(':checkbox').prop('checked', !isSelected);
});

// Problem : Checkbox !== select row
$("#selectAll, #unselectAll").on("click", function() {
  var selectAll = this.id === 'selectAll';
  $("#example tr :checkbox").prop('checked', selectAll);
});

I think the checklist is just for display, for row selected and to mark it.

How when the select / unselect button is clicked,

it select on row table too, Not just on the checkbox?

Code Snippet Demonstration :

$('#example').dataTable();

//Select row table
$('#example').on('click', 'tr', function() {
  var $row = $(this),
    isSelected = $row.hasClass('selected')
  $row.toggleClass('selected')
    .find(':checkbox').prop('checked', !isSelected);
});

// Problem : Checkbox !== select row
$("#selectAll, #unselectAll").on("click", function() {
  var selectAll = this.id === 'selectAll';
  $("#example tr :checkbox").prop('checked', selectAll);
});
<script src="http://ift.tt/20g0BuL"></script>
<script src="http://ift.tt/2eY7LrW"></script>
<link href="http://ift.tt/2jfHpCW" rel="stylesheet"/>


<button type="button" id="selectAll"> Select </button>
<button type="button" id="unselectAll"> UnSelect </button>

<table id="example" class="myclass" />
<thead>
  <tr>
    <th>
    </th>
    <th>Name</th>
    <th>Company</th>
    <th>Employee Type</th>
    <th>Address</th>
    <th>Country</th>
  </tr>
</thead>
<tbody>

  <tr>
    <td>
      <input type="checkbox" />
    </td>
    <td>Calvin</td>
    <td>TCS</td>
    <td>IT</td>
    <td>San Francisco</td>
    <td>US</td>
  </tr>

  <tr>
    <td>
      <input type="checkbox" />
    </td>
    <td>Ananda</td>
    <td>TCS</td>
    <td>IT</td>
    <td>San Francisco</td>
    <td>US</td>
  </tr>

  <tr>
    <td>
      <input type="checkbox" />
    </td>
    <td>John</td>
    <td>TCS</td>
    <td>IT</td>
    <td>San Francisco</td>
    <td>US</td>
  </tr>

  <tr>
    <td>
      <input type="checkbox" />
    </td>
    <td>Doe</td>
    <td>TCS</td>
    <td>IT</td>
    <td>San Francisco</td>
    <td>US</td>
  </tr>
</tbody>

JSFiddle




KnockoutJS Binding a checkbox with both "checked" and "click" bindings causes unexpected behavior

here is the code I've been working on.

Javascript:

function ViewModel() {
  var self = this;

    self.isChecked = ko.observable(false);

  self.testing = function(){
    console.log("hello from testing");
  }
}

var app = new ViewModel();

ko.applyBindings(app);

And here's the html:

<div>
  <div>
    <button data-bind="click: testing" type="button">Something</button>
    <input data-bind="checked: isChecked, click: testing" type="checkbox" />
    <input data-bind="checked: isChecked" type="checkbox" />
  </div>
</div>

What I'm looking to accomplish is that I want a checkbox, whose value is data-binded to a variable in my model and updates accordingly. And at the same time, whenever a user clicks the checkbox to change its boolean value, I want a function to be executed AFTER the value is changed in the model and the checkbox is updated.

I have two buttons data-binded to the same value just for testing purposes. When I click the checkbox that is binded with click to testing, its value doesn't update, but the function executes correctly. However, the other checkbox DOES indeed update to reflect the changes in the model when the button is clicked.

What is happening that causes this behavior, and how could I write a better solution to achieve what I'm looking for?




Add/remove checkbox values to/from array when checked and unchecked (jQuery)

On a project I'm currently working on, I'm using radio buttons and AJAX to change the posts displayed on a custom WordPress template page. It works perfectly, however, the client would like it to be checkboxes instead of radio inputs so that each time a user selected a new category, it adds to the posts being displayed instead of replacing it.

For example: currently, if you click category1, category1 posts show up. Click category2, and category2 posts replace the category1 posts. The client would like BOTH category1 and category2 to show up if both checkboxes are selected.

Here's my JS currently:

jQuery(document).ready(function ($) {
  // AJAX Post Filter scripts
  var $checkbox = $("#filter input:checkbox");
  var $checked = $("#filter input:checkbox:checked");
  var $unchecked = $("#filter input:checkbox:not(:checked)");
  $checkbox.change(function () {
    if ($checked) {
      var catID = $(this).val();

      $.ajax({
        type: 'POST',
        url: afp_vars.afp_ajax_url,
        data: {
          "action": "load-filter",
          category__in: catID
        },
        success: function (response) {
          $(".filter-section").empty().html(response);
          return false;
          console.log('success!');
        }
      });
      console.log(catID);
    }
  });
});

I'm pretty sure I need to do something with .map() with my variable catID as I've seen in some other threads, but I haven't been able to find a solution that works quite right for me.




Cannot check all table rows on second time

I have a HTML table where I display some data. I have a problem when trying to do multiple selection.

If I click the checkbox on <th> (which selects all rows), all checkboxes in tbody > tr are selected - as expected. I click again and all deselect - as expected. If I click again the th checkbox it doesn't select anything inside tbody. How can I fix this issue?

$(document).ready(function() {
  toggleDeleteButton = function() {
    // alert($('.selector:checked').length);

    if ($('.selector:checked').length) {
      $('.btn-delete-selected').removeClass('disabled');
    } else {
      $('.btn-delete-selected').addClass('disabled');
    }
  }
  
  function update_selection(obj) {
    var state = obj.checked;
    if (state === undefined) {
      state = false;
    }
    $(obj).closest('table').find('input[type=checkbox][disabled!="disabled"]').attr('checked', state);
  }
});
<script src="http://ift.tt/1oMJErh"></script>
<table class="table">
  <thead>
    <tr>
      <th class=""><input onchange="update_selection(this); toggleDeleteButton();" type="checkbox"></th> // Selecting all
      <th class="">
        <a href="#">#</a>
      </th>
      <th class="">
        <a href="#">Data #1</a>
      </th>
      <th class="">
        <a href="#">Data #2</a>
      </th>
    </tr>
  </thead>
  <tbody>
    <tr class="tr even incomplete ">
      <td class="center"><input class="selector" value="57696" onchange="toggleDeleteButton();" type="checkbox"></td>
      <td class="center">3</td>
      <td class="text-right">£ 1.00</td>
      <td class="center">Foo</td>
    </tr>
    <tr class="tr even incomplete ">
      <td class="center"><input class="selector" value="57698" onchange="toggleDeleteButton();" type="checkbox"></td>
      <td class="center">4</td>
      <td class="text-right">£ 2.50</td>
      <td class="center">FooBar</td>
    </tr>
    <tr class="tr even incomplete ">
      <td class="center"><input class="selector" value="57720" onchange="toggleDeleteButton();" type="checkbox"></td>
      <td class="center">5</td>
      <td class="text-right">£ 3.00</td>
      <td class="center">Bar</td>
    </tr>
  </tbody>
</table>



Icon Radio and Checkbox not showing in custom Look and Feel

I'm creating a custom Look and Feel for a company as my final trainee ship for graduation. I've been stuck on this part for a few days now and me and my colleagues can't seem to fix it.

I'm trying to create a custom radio button an checkbox for the Look and Feel. Now when I want to display the stock ones to the screen / JFrame it won't display.

Once I activate my Look and Feel the checkboxes and radio buttons dissapear. But the label of them does display on screen. When I create the checkbox / radio outside the look and feel or give a nimbus look and feel to them, it does display. So somehow my Look and Feel is breaking things. Can anyone help?

This is my code for the radio button;

public class MyRadioBut extends BasicRadioButtonUI {


    public MyRadioBut()
    {
        super();
    }

    public static ComponentUI createUI(JComponent c) {
        return new MyRadioBut();
    }

    @Override
    public void installUI(final JComponent c) {
        super.installUI(c);
    }

    public static MyRadioBut createRadio()
    { 
        MyRadioBut radio = new MyRadioBut();

        return radio;
    }
    private boolean defaults_initialized = false;
    @Override
    public void installDefaults(AbstractButton b) {  
        super.installDefaults(b);

    }
}

Code for checkbox is the same.

Look and feel code;

package iac.lookandfeel;

import java.awt.Font;

import javax.swing.SwingUtilities;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicLookAndFeel;


public class MyLookAndFeel extends BasicLookAndFeel {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    static MyButton btn = new MyButton();
    static MyProgressBar pb = new MyProgressBar();
    static MyLabel lbl = new MyLabel();
    static MyTab tab = new MyTab();
    static MyRadioBut radio = new MyRadioBut();
    static MyComboBox combo = new MyComboBox();

    public MyLookAndFeel() {
        super();

    }

    @Override
    public String getName() {
        // TODO Auto-generated method stub
        return "IAC Look and Feel";
    }

    @Override
    public String getID() {
        // TODO Auto-generated method stub
        return "IAC Look and Feel";
    }

    @Override
    public String getDescription() {
        // TODO Auto-generated method stub
        return "IAC's Look And Feel";
    }

    @Override
    public boolean isNativeLookAndFeel() {
        // TODO Auto-generated method stub
        return false;
    }

    @Override
    public boolean isSupportedLookAndFeel() {
        // TODO Auto-generated method stub
        return true;
    }

    @Override
    public boolean getSupportsWindowDecorations()
    {
        return true;
    }
    public static void setAllFonts() {
        Font defaultFont = UIManager.getDefaults().getFont("Button.font");
        int defaultSize = defaultFont.getSize(); 
        Font font = new Font("Serif", Font.PLAIN, 50); 

        UIManager.put("Button.font", font);

        UIManager.put("RadioButton.font", font);
        UIManager.put("CheckBox.font", font);

        UIManager.put("ComboBox.font", font);
        UIManager.put("Label.font", font);
        UIManager.put("TabbedPane.font", font);
        UIManager.put("TextField.font", font);
        UIManager.put("PasswordField.font", font);
        UIManager.put("TextArea.font", font);
        UIManager.put("ProgressBar.font", font);

    }

    @Override
    protected void initClassDefaults(UIDefaults table)
    { 
        setAllFonts();
        MyButton.createButton(); 
        MyProgressBar.createBar();
        MyLabel.createLabel();
        MyTab.createTab();
        MyRadioBut.createRadio();
        MyCheckBox.createCheckBox();
        MyComboBox.createCombo();


        super.initClassDefaults(table);
        String IACPackage = "iac.lookandfeel.";
        final String basicPackageName = "javax.swing.plaf.basic.";
        Object[] uiDefaults = {
                "ButtonUI", IACPackage + "MyButton",
                "CheckBoxUI", IACPackage + "MyCheckBox",
                "ColorChooserUI", basicPackageName + "BasicColorChooserUI",
                "FormattedTextFieldUI", basicPackageName + "BasicFormattedTextFieldUI",
                "MenuBarUI", basicPackageName + "BasicMenuBarUI",
                "MenuUI", basicPackageName + "BasicMenuUI",
                "MenuItemUI", basicPackageName + "BasicMenuItemUI",
                "CheckBoxMenuItemUI", basicPackageName + "BasicCheckBoxMenuItemUI",
                "RadioButtonMenuItemUI", basicPackageName + "BasicRadioButtonMenuItemUI",
                "RadioButtonUI", IACPackage + "MyRadioBut",
                "ToggleButtonUI", basicPackageName + "BasicToggleButtonUI",
                "PopupMenuUI", basicPackageName + "BasicPopupMenuUI",
                "ProgressBarUI", IACPackage + "MyProgressBar",
                "ScrollBarUI", basicPackageName + "BasicScrollBarUI",
                "ScrollPaneUI", basicPackageName + "BasicScrollPaneUI",
                "SplitPaneUI", basicPackageName + "BasicSplitPaneUI",
                "SliderUI", basicPackageName + "BasicSliderUI",
                "SeparatorUI", basicPackageName + "BasicSeparatorUI",
                "SpinnerUI", basicPackageName + "BasicSpinnerUI",
                "ToolBarSeparatorUI", basicPackageName + "BasicToolBarSeparatorUI",
                "PopupMenuSeparatorUI", basicPackageName + "BasicPopupMenuSeparatorUI",
                "TabbedPaneUI", IACPackage + "MyTab",
                "TextAreaUI", basicPackageName + "BasicTextAreaUI",
                "TextFieldUI", basicPackageName + "BasicTextFieldUI",
                "PasswordFieldUI", basicPackageName + "BasicPasswordFieldUI",
                "TextPaneUI", basicPackageName + "BasicTextPaneUI",
                "EditorPaneUI", basicPackageName + "BasicEditorPaneUI",
                "TreeUI", basicPackageName + "BasicTreeUI",
                "LabelUI", IACPackage + "MyLabel",
                "ListUI", basicPackageName + "BasicListUI",
                "ToolBarUI", basicPackageName + "BasicToolBarUI",
                "ToolTipUI", basicPackageName + "BasicToolTipUI",
                "ComboBoxUI", IACPackage + "MyComboBox",
                "TableUI", basicPackageName + "BasicTableUI",
                "TableHeaderUI", basicPackageName + "BasicTableHeaderUI",
                "InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
                "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
                "DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
                "FileChooserUI", basicPackageName + "BasicFileChooserUI",
                "OptionPaneUI", basicPackageName + "BasicOptionPaneUI",
                "PanelUI", basicPackageName + "BasicPanelUI",
                "ViewportUI", basicPackageName + "BasicViewportUI",
                "RootPaneUI", basicPackageName + "BasicRootPaneUI",
        };
        //   UIManager.put(MyLookAndFeel.UI_CLASS_ID,  MyButton.class.getName());
        table.putDefaults(uiDefaults);
    }
}

IACPackage is my own package which I use in all components.

Hope one of you guys got an idea.

I have a test gui which I test the look and feel on: I create the checkbox and radio like this;

JCheckBox CBox = new JCheckBox("Checkbox");
    JRadioButton Radio = new JRadioButton("Radio"); 

It does display the string but not the icons.




Select All checkboxes in vue.js

Here is my fiddle : DEMO

1) On choice of all checkboxes, "Select All" should get checked.

2) On check of "Select All", all the checkboxes should get checked at once.

3) After checking "Select All", if one or more checkbox is unchecked, select all gets unchecked.

How can this be done in vuejs? The closest example I found was http://ift.tt/2iWNp0T but could not get it to work in my code.

computed: {
    selectAll: {
        get: function () {
            return this.users ? this.selected.length == this.users.length : false;
        },
        set: function (value) {
            var selected = [];

            if (value) {
                this.users.forEach(function (user) {
                    selected.push(user.id);
                });
            }

            this.selected = selected;
        }
    }
}

Any help would be much appreciated. Thank you :)




execute function when the checkbox is checked

I have below function when we check or uncheck the check box (inside the gridview) it will show the popup and other processing information..

Is there any way to execute this function only when checkbox is checked and not on unchecked condition..

below is my function

 $(document).ready(function () {
    $('#<%= gvPRCertInfo.ClientID %> input[type="checkbox"]').change(function () {

        var signValue = $(this).closest('tr').children('td:eq(4)').html();

        if (signValue == "Virtual") {

            var confirm_value = document.createElement("INPUT");
            confirm_value.type = "hidden";
            confirm_value.name = "confirm_value";

            if (confirm("you have selected virtual do u want to create a new name for this?")) {
                confirm_value.value = "Yes";
            } else {
                confirm_value.value = "No";
            }
            document.forms[0].appendChild(confirm_value);
        }
    });
});

this is my gridview

 <asp:GridView ID="gvPRCertInfo" runat="server" GridLines="None"                                                                                  
   CssClass="data responsive">
           <Columns>
          <asp:TemplateField HeaderText="Select" SortExpression="">
             <HeaderTemplate>
               <asp:CheckBox ID="chkboxSelectAll" runat="server" AutoPostBack="true" OnCheckedChanged="chkboxSelectAll_CheckedChanged" />
                </HeaderTemplate>
                   <ItemTemplate>
                    <asp:CheckBox ID="chkCert" AutoPostBack="true" ClientIDMode="Static" OnCheckedChanged="chkCert_CheckedChanged" runat="server" />
                    <input type="hidden" id="hdnCertId" runat="server" value='<%# DataBinder.Eval(Container.DataItem, "CertId") %>' />
                           </ItemTemplate>
                   </asp:TemplateField>
            <asp:BoundField DataField="CertificateID" HeaderText="Certificate ID" HeaderStyle-HorizontalAlign="Center" />

 ................
 .................

Would any one please suggest any ideas on how to execute only when i check the checkbox.. many thanks in advance




WPF unsmooth double-animation

I read quite a few questions about choppy animations here but sadly none have solved my issue.


I have a window and under some circumstances (checkbox check) the window height should increase or decrease.

I wrote a small method for the animation and when the checkbox is checked it executes the method.

public static void NewWindowHeight(MainWindow MainWindow1, int Height)
{
    double oldheight = MainWindow1.Height;
    DoubleAnimation animation = new DoubleAnimation(oldheight, Height, TimeSpan.FromSeconds(0.2));
    MainWindow1.BeginAnimation(MainWindow.HeightProperty, animation);
}


I have two checkboxes and at a defined combination the window height should be set to a specific value. This is the code behind the checkbox_clicked method. (I only show this one because it is basically the same code with the other checkbox)

private void CheckBoxSetup_Click(object sender, RoutedEventArgs e)
{           
    if (CheckBoxSetup.IsChecked == false && CheckBoxUpdate.IsChecked == false)
    {
        MethodsClass.NewWindowHeight(MainWindow1, 180);
    }
    if (CheckBoxSetup.IsChecked == true || CheckBoxUpdate.IsChecked == true)
    {
        MethodsClass.NewWindowHeight(MainWindow1, 220);
    }
    if (CheckBoxSetup.IsChecked == true && CheckBoxUpdate.IsChecked == true)
    {
        MethodsClass.NewWindowHeight(MainWindow1, 260);
    }
}

All works well, but the animation is kinda choppy. Not terrible but definetily not smooth. What could be the reason for this? How could i solve this?


Some pictures for better understanding:

enter image description here

enter image description here

enter image description here