dimanche 31 janvier 2016

Excel Checkbox/Checklist-Copy and Paste to specific range based on Date

I am new to VBA and Macros.

I have created a Spreadsheet for generating Service Reports. In that, I have a checklist of tasks that need to be completed. So far when a checkbox/task is checked as complete, it will highlight that item green.

The checkboxes are Form Control. They are in Column AD starting with Row 56. The Tasks are listed in Column AE starting with Row 56... and on down. AD57-AE57...

I have a range of cells (A56:A80, A83:A107...) These are for Techs to enter in completed tasks for that day. There is a date (IE- Cell B55,B82..) for each range that is set when the Report is generated.

Here's what I am having trouble with: For Example,

If Checkbox AD56 = True and Cell B55, B82, etc = Today's Date then Copy and Paste the Value of Cell AE56 to Cell A56 or A83... or in the next available cell down in that range based on the date condition.

See pictures for reference to the list and completed task range.

Thanks,

STG

Checklist

Completed Tasks




In android studio,how to display the selected items from check box in a new page ?

In Android studio,how to display the the selected item from check box in different page ?




CheckBox text to change based on its IsChecked

I want a CheckBox text to changed based on the IsChecked status.

Tried with the following, but it complains about not having the property Content

                <CheckBox Name="IsManualInput" IsChecked="{Binding Path=IsManualInputExclusion, Mode=TwoWay}" >
                    <CheckBox.Style>
                        <Style>
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" Value="True" >
                                    <Setter Property="Content" Value="Manual" />
                                    <Setter Property="IsReadOnly" Value="True"/>
                                </DataTrigger>
                                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsChecked}" Value="True" >
                                    <Setter Property="Content" Value="Define exclusion(s) manually.." />
                                    <Setter Property="IsReadOnly" Value="True"/>
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </CheckBox.Style>
                </CheckBox>




How to Dynamically change a field value in the jsp on click of checkbox?

This is my Jsp in which these are the elements. Now my question is, how can i change the offset date () which i set in my struts action class on click of the checkBox?

Offset date is nothing but disabling the dates till some decided date, suppose on checking the checkbox, the user can select dates after 2 days On deselcting, user can select after 1 day.

At present my logic works fine : on load of the screen, the proper offset date is selected, but i dint find the logic on how to dynamically call that method and change the offset date on click of the checkbox. Do I hv to submit the form each time on click of checkbox .. If yes how?

<script type="text/javascript">
function showRow() {

    var check = document.getElementById('check');
    var divObj = document.getElementById('hiddenrow');
    divObj.style.display = "none";
    check.onclick = function() {
        if (divObj.style.display == ''){
        divObj.style.display = 'none';
        }
        else
        {
        divObj.style.display = '';
        }
    }
}
window.onload = function() {
    showRow();
}

</script>
<s:actionerror cssClass="actionError" /> <s:form id="documentForm"
    namespace="/secure/ptu" action="updateTimingDetails"
    method="post">
    <table class="columns" style="margin-top: 1em;">

            <tr>
                <s:select label="Distribution Type"
                    list="#{'Mail By Date':'Mail By Date','Mail On Date':'Mail On Date'}"
                    name="mailOption" value="2" />
            </tr>
            <tr>
                <td>Distribution Date:</td>
                <td colspan="3"><input type="text" maxlength="10" id="mailDate"
                    name="mailDate" type="text" size="10" value="${mailDate}" /></td>
            </tr>
            <tr></tr>
            <tr align="left">
                <td><s:label for="check">
                    <input type="checkbox" name="check" id="check" size="20" value="true" />
                     Rush/Expedite</s:label></td>
            </tr>
        <tbody id="hiddenrow" style="display: none;">
            <tr>
                <td>Expedite Code:</td>
                <td><s:select
                    list="A list"
                    name="expediteCode" headerKey="-1" value="expediteCode"
                                    headerValue="--Select--" theme="simple"/></td>
                <td>Expedite Comment(optional):</td>
                <td><s:textarea theme="simple" name="expediteComment" cols="20"
                    rows="3"></s:textarea></td>
            </tr>
        </tbody>
    </table>
    <s:include value="/secure/ptu/ptuBottomNavigation.jsp" />
</s:form></div>

</body>
<script type="text/javascript">
            new Datepicker('mailDate', 
            {
                'dateFormat': 'm/d/Y',
                'notBefore': '<s:date name="startDateOffset" format="dd-MM-yyyy" />'
            }
            );

    </script>

Inside Action Class,

 public final Date getStartDateOffset()
    {
        return startDateOffset;
    }

    public final void setStartDateOffset(Date startDateOffset)
    {
        this.startDateOffset = startDateOffset;
    }

    /**
     * Sets the offset for the date as per Ptu business requirement
     */
    private void setDistributionDateOffset()
    {
        System.out.println("setDistributionDateOffset");
        Date currentSystemDate = new Date();
        Calendar c = GregorianCalendar.getInstance();
        //
        if(c.get(Calendar.HOUR_OF_DAY) > hour)
        {
            setStartDateOffset(DateUtils.addDays(currentSystemDate, 1));
            System.out.println("Calendar.HOUR_OF_DAY >10");

        }

        else
        {
            System.out.println("currentSystemDate is set----");
            setStartDateOffset(currentSystemDate);
        }

    }

This helps me get the offset date.




check checkbox one by one with one button

I have 8 checkboxes in my form and one button, what i need is:

For each button click i want each of checkbox to be checked one by one. for example:

first click 

checkbox1.checked = true
checkbox2.checked = false
checkbox3.checked = false
checkbox4.checked = false

second click

checkbox1.checked = true
checkbox2.checked = true
checkbox3.checked = false
checkbox4.checked = false

third click

checkbox1.checked = true
checkbox2.checked = true
checkbox3.checked = true
checkbox4.checked = false

Can someone help me if this is possible? Thanks in advance




How to hide and show table tr's by value of first row

i have a question. I have table like.

  <input type="checkbox" id="one" value="Jill" checked > Jill
  <input type="checkbox" id="two" value="Eve" checked> Eve
  <input type="checkbox" id="three" value="Mike" checked> Mike
<table id="mytable">
  <tr>
    <td>Jill</td>
    <td>Smith</td> 
    <td>50</td>
  </tr>
   <tr>
    <td>Jill</td>
    <td>Smile</td> 
    <td>61</td>
  </tr>
    <tr>
    <td>Mike</td>
    <td>Jenkins</td> 
    <td>43</td>
  </tr>
  <tr>
    <td>Eve</td>
    <td>Jackson</td> 
    <td>94</td>
  </tr>
  <tr>
    <td>Mike</td>
    <td>Piterson</td> 
    <td>23</td>
  </tr>
</table>

I need to hide and show trs of this table by checked value, and hide them when field is unchecked, but only those where first row is same as value of checkbox. On load it should be visible with all checkbox checked, and if i unchecked one or more field, others should be visible. I get only to the point where i can hide, but when i checked it again it reload whole table, so i stuck. I use my old question to do this, Jquery filtering by two values . Thank you for interest.




How can i make checkbox for my condtion using angularjs?

I am trying to create checkbox list based on my condtion but i can't able to solve the problem in controller i have given two variables

var selectedbrand = 'Nokia';
var submodel ='Lumia';

based on those two variable checkbox list should change for example i have given selectedbrand = 'Nokia'; and var submodel ='Lumia'; for this 3 checkbox should display

1.Lumia 735 TS

2.Lumia 510

3.Lumia 830

if i change those two variables like this

var selectedbrand='Nokia';

var submodel='Asha';

2 checkbox should display

1.Asha 230

2.Asha Asn01

same thing for samsung also based on that two variables check box list should change .help me out to solve task.i have added my code below

var myApp = angular.module('myApp',[]);

//myApp.directive('myDirective', function() {});
//myApp.factory('myService', function() {});

function MyCtrl($scope) {
var selectedbrand = 'Nokia';
var submodel ='Lumia';
    $scope.phones = [{
    "_id": {
        "$oid": "56a9c44f40d0275643cfc04e"
    },
    "default": [],
    "Categories": [
        {
            "models": [
                {
                    "submodel": [
                        {
                            "price": "7500",
                            "name": "Lumia 735 TS"
                        },
                        {
                            "price": "8100",
                            "name": "Lumia 510"
                        },
                        {
                            "price": "9900",
                            "name": "Lumia 830"
                        }
                    ],
                    "name": "Lumia"
                },
                {
                    "submodel": [
                        {
                            "price": "10000",
                            "name": "Asha 230"
                        },
                        {
                            "price": "11999",
                            "name": "Asha Asn01"
                        }
                    ],
                    "name": "Asha"
                }
            ],
            "brandname": "Nokia",
            "id": "986745"
        },
        {
            "models": [
                {
                    "submodel": [
                        {
                            "price": "5000",
                            "name": "Trend 840"
                        },
                        {
                            "price": "6999",
                            "name": "A5"
                        }
                    ],
                    "name": "Galaxy"
                },
                {
                    "submodel": [
                        {
                            "price": "12000",
                            "name": "Asha 230"
                        }
                    ],
                    "name": "Asha"
                }
            ],
            "brandname": "Samsung",
            "id": "144745"
        }
    ],
    "Storename": "Zig Zag Mobiles",
    "__v": 0
}

    ]
}

my html code:

<div ng-app="myApp" ng-controller="MyCtrl">
  <div class="item" ng-repeat="item in phones" ng-show="filteredEntries.length">
    {{ item.Categories.models.name }}
 <ul>
  <li ng-repeat="model in filteredEntries = (item.models | filter:{ model.name: 'Nokia'})" class="model">
    <input type="checkbox" ng-checked="item.checked"> {{ model.submodel.name }}
  </li>
</ul>
<button ng-click="checkItems()">Do</button>
</div>  
</div>




Multi checkbox search in rails

Now working on single checkbox search, I need multi checkbox search, my code is below:

<form action="<%= search_path %>" method="get">
  <%= check_box_tag :title, "A" %> A
  <%= check_box_tag :title, "B" %> B
  <%= check_box_tag :title, "C" %> C
</form>

Like this

For example titleA, B, C & D I need search all checkbox checked




Filtering by checkbox in rails

I have suffering one issue in my rails application search by checkbox.

This is my checkbox code:

<form action="<%= search_path %>" method="get">
  <%= check_box_tag :title, params[:title] %> Title
  <input type="submit" value="Fielter" />
</form>

This code searching but showing default =on in url like this:

http://localhost:3000/search?title=on

How can I search title like ABC & remove default =on.

I need like this :

http://localhost:3000/search?title=ABC

Thanks




samedi 30 janvier 2016

Toggle checkboxes in native Listview in external application

i am currently facing the problem of changing the state of checkboxes in an external application via .Net.

I successfully can obtain the handle of the control, and just need set the state of an element of a given index.

I found this old thread with an example in VB6, but fail to get it working in VB.net: http://ift.tt/1KisvmS

I hope somebody is able to help me out, thanks in advance :)

My Translated version which neither works, nor throws any error:

Public NotInheritable Class Win32
    Private Const LVM_FIRST As Long = &H1000
    Private Const LVIS_SELECTED = &H2
    Private Const LVM_SETITEMSTATE = (LVM_FIRST + 43)
    Private Const LVIF_STATE = &H8&
    Private Const LVIS_STATEIMAGEMASK As Long = &HF000

    <StructLayoutAttribute(LayoutKind.Sequential)> _
    Private Structure LVITEM
        Public mask As UInteger
        Public iItem As Integer
        Public iSubItem As Integer
        Public state As UInteger
        Public stateMask As UInteger
        Public pszText As IntPtr
        Public cchTextMax As Integer
        Public iImage As Integer
        Public lParam As IntPtr
    End Structure

    Public Shared Sub ListView_SetItemState(ByVal hWndLV As IntPtr, ByVal i As Long, ByVal nData As UInteger, ByVal mask As UInteger)
        Dim LVI As New LVITEM
        LVI.stateMask = mask
        LVI.state = nData
        LVI.mask = LVIF_STATE

        Dim ptrLvi As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(LVI))
        Marshal.StructureToPtr(LVI, ptrLvi, False)

        SendMessageA(hWndLV, LVM_SETITEMSTATE, New IntPtr(i), ptrLvi)
    End Sub

    Public Shared Sub ListView_SetCheckState(ByVal hWndLV As IntPtr, ByVal i As Long, ByVal fCheck As Integer)
        ListView_SetItemState(hWndLV, i, CUInt(&H1000& * (1 - fCheck)), LVIS_STATEIMAGEMASK)
    End Sub

    <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Public Shared Function FindWindowEx(ByVal parentHandle As IntPtr, ByVal childAfter As IntPtr, ByVal lclassName As String, ByVal windowTitle As String) As IntPtr
    End Function

    <DllImport("user32.dll", SetLastError:=True, CharSet:=CharSet.Auto)> _
    Private Shared Function SendMessageA(ByVal hWnd As IntPtr, ByVal Msg As UInteger, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
    End Function
End Class

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    Dim p As Process = System.Diagnostics.Process.GetProcessesByName("OBS")(0)
    Dim notepadHwnd As IntPtr = p.MainWindowHandle
    Dim editHwnd2 As IntPtr = Win32.FindWindowEx(notepadHwnd, IntPtr.Zero, "SysListView32", Nothing)


    Win32.ListView_SetCheckState(editHwnd2, -1, 1)
End Sub




Copy/Paste Data From Multiple 'Data' Workbooks To A Single 'Main' Workbook Based On A Start/End Date And Checkbox-selected Rows

GIVEN

a) A workbook (MainWorkBook) with 2 worksheets:

  • Main1: To enter the start and end date, to select (up to) 15 (3 x 5) values from 15 different dropdown menus, and 17 parameters that can be selected with a checkbox (The form control checkbox is linked to the underlying cell ($B10:$B26)).
  • Main2: To copy the results (Starting at B2).

b) Many workbooks (DataWorkBook) for several companies (CompanyXX) that come in several 'versions' (VersionXX), that each have several worksheets (DataWorkSheet: TypeXX).

See screenshots in attachment.

PURPOSE

The idea is to import (paste) all of the data from the (data) workbooks into the "Main2" worksheet of the (main) workbook based on the selections that were made on the "Main1" worksheet: start/end date, companies, versions, types, and the parameters that were selected by the checkboxes.

QUESTION

What is working thus far, is that I'm able to open the correct workbook(s) at the correct worksheet, and I'm able to copy/paste pre-set rows of data (Code has been removed in the example below), but I'm still not able to copy/paste data for the selected rows (The rows selected by the checkboxes) between start and end date...

CODE (ATTEMPT)

Sub ImportData()

Dim MainWorkBook As Workbook
Dim DataWorkBook As Workbook
Dim MainWorkSheet As Worksheet
Dim DataWorkSheet As Worksheet
Dim i As Long
Dim Type As String
Dim ChkBox As CheckBox
Dim j As Long
Dim StartDate As Date
Dim EndDate As Date
Dim DataRange As Range
Dim Data As Range
Dim TargetRow As Long

Application.ScreenUpdating = False

Set MainWorkBook = ThisWorkbook
Set MainWorkSheet = MainWorkBook.Worksheets("Main1")

With MainWorkBook.ActiveSheet

StartDate = Cells(3, 3).Value
EndDate = Cells(4, 3).Value

For i = 3 To 7

If MainWorkSheet.Cells(6, i).Value <> "" Then

Type = MainWorkSheet.Cells(8, i).Value
Set DataWorkBook = Workbooks.Open("D:\ 'Some folders' \" & .Cells(6,  
i).Value & "-" & .Cells(30, 2) & "-" & .Cells(7, i).Value & ".xlsx")
DataWorkBook.Worksheets(Type).Select

MainWorkBook.Worksheets("Main1").Activate

j = 10
TargetRow = 2

For Each ChkBox In ActiveSheet.CheckBoxes
If ChkBox.Value = Checked Then

Set MainWorkSheet = MainWorkBook.Worksheets("Main2")

DataWorkBook.Sheets(Type).Activate
Set DataWorkSheet = DataWorkBook.Worksheets(Type)

Set DataRange = Application.Intersect(DataWorkSheet.Range("B4:ZZ4"),      
DataWorkSheet.UsedRange)
For Each Data In DataRange.Cells
If Data.Value >= StartDate And Data.Value <= EndDate Then
Data.Offset(j, 0).Resize(1, 2).Copy _
MainWorkSheet.Cells(TargetRow, 2)
TargetRow = TargetRow + 1
End If
Next Data

j = j + 1

End If

Next ChkBox

On Error Resume Next

End If

Next i

End With

Application.ScreenUpdating = True

End Sub

Anybody who wants to give it a shot? :-)

Any help is appreciated!

MainWorkBook DataWorkBook




Keep checkbox checked, after refresh and submit

I'm trying to keep a checkbox checked, but after I refresh the page, if the checkbox is checked the database will get updated with 'yes', but the database automatic updates it to 'no' even if the checkbox is checked with local.store, I hope somebody can help me. This is my code.

    <form action="" method="POST">
     <label for="option1">Waarschuwingsbericht inschakelen voordat het volgende pack wordt geopend als jou pack boven de 200.000 waard is?</label><input id='option1' type="checkbox" name="checkbox" value="yes"><br>
      <input type="submit" value="Opslaan en nog een pack openen">
    </form>
<?
    if(isset($_POST['checkbox'])){
        $sql = "UPDATE users SET puntenchecked = 'yes' WHERE username = '" . $usernamez . "'";
        $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
    }
    else {
        $sql = "UPDATE users SET puntenchecked = 'no' WHERE username = '" . $usernamez . "'";
        $result = mysql_query($sql) or die('Query failed: ' . mysql_error());
    }
?>
<script>
$(function(){
    var test = localStorage.input === 'true'? true: false;
    $('input').prop('checked', test || false);
});

$('input').on('change', function() {
    localStorage.input = $(this).is(':checked');
    console.log($(this).is(':checked'));
});
</script>




materialize switch with mvc model

I am using this code. Switch is not working so not able to get value in check box for.

<div>
    Duplicate Customer Email:<a href="#!" class="secondary-content">
        <div class="switch">
            <label>
                NO
                @Html.CheckBoxFor(m => m.DuplicateCustomerEmail, new { @class = "validate" })
                @Html.HiddenFor(m => m.DuplicateCustomerEmail, new { @class = "validate" })
                <span class="lever"></span> YES
            </label>
        </div>
    </a>
</div>

Please suggest how to bind check box for to materialize switch.




vendredi 29 janvier 2016

Insert array where checkboxes are checked

Being new to PHP and MySQL, I've picked up quite a few things reading here. This post is about the closest question I can find relative to my issue. I borrowed some from the solution but it's only gotten me so far.

I populate a form with table data from a SELECT statement, currently 15 rows. Each row from the result has a checkbox and corresponding data. There's also a textarea in the form.

I need to insert the text input from the textarea along with the Case_No and Client_No associated with the checkbox, into a different table...only where the checkbox is checked. Only the text will be same for each row. None of the unchecked checkboxes should be included in the INSERT.

I realize the answer is probably some sort of loop, but I don't have much experience with inserting from loops, only displaying data from loops.

Here is my form:

<form method="post" name="group_note" action="group_test.php?Counselor=<?php echo $_GET['Counselor'];?>"/>
<table border="1" width="650" cellpadding="5" cellspacing="0" bordercolor="#999999">
<tr><th>Group Note</th></tr>
<tr><td><textarea name="Note" rows="10" cols="115"></textarea></td></tr>
<tr><th align="left">Select clients below to receive this group note &nbsp; <input type="submit" value="Add Group Note"></th></tr>
</table>
<table border="1" cellpadding="5" cellspacing="0" bordercolor="#999999">
<thead>
  <tr>
    <th bgcolor="#009999">Select</th>
    <th bgcolor="#009999">Name</th>
    <th bgcolor="#009999">Case No.</th>
    <th bgcolor="#009999">Client No.</th>
    </tr>
  </thead>
  <tbody>
<?php foreach ($dbh -> query($sql) as $row) { ?>        
<tr> 
        <td><input type="checkbox" name="groupselect[]" value="<?php echo $row['Case_No'];?>" /></td>
        <td><?php echo $row['FirstName']. " " . $row['LastName']; ?></td>
        <td><?php echo $row['Case_No']; ?></td> 
        <td><?php echo $row['Client_No']; ?><input type="hidden" name="Client_No" value="<?php echo $row['Client_No']; ?>"/></td>

<?php  }  ?>
</tbody>
</table>
    <input type="hidden" name="MM_insert" value="group_note">
</form>

And the Insert statement:

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "group_note")) {
try
    {
        $dbh = new PDO("mysql:host=$mysql_hostname;dbname=$mysql_database; charset=utf8", $mysql_username, $mysql_password);
        $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $insertGroup = array();
        foreach ($_POST['groupselect'] as $i => $value) {
        $GroupNote_CaseNo=$_POST['groupselect'][$i];
        $GroupNote_ClientID=$_POST['Client_No'][$i];
        $GroupNote=$_POST['Note'];
        $insertGroup[]="(".$GroupNote_CaseNo.", ".$GroupNote_ClientID.", ".$GroupNote.")";
        $Note = "INSERT INTO group_note GroupNote_CaseNo, GroupNote_ClientID, GroupNote VALUES ". implode(", ", $insertGroup). "GroupNote_CaseNo=VALUES(GroupNote_CaseNo), GroupNote_ClientID= VALUES(GroupNote_ClientID), GroupNote=VALUES(GroupNote)";
        $stmt->execute();
        $stmt->closeCursor();       
    }
    }
    catch (Exception $e)
    {
    $message = 'Something not working right!!';
    }
}

When I select two or three checkboxes and insert some text, on submit I get this result from var_dump($_POST['groupselect'])

array(3) { [0]=> string(22) "(1518-R, 4, This note)" 1=> string(22) "(1534-R, 3, This note)" [2]=> string(22) "(4062-R, 3, This note)" }

The ClientNo is only showing one digit, and they are three digits long. If I remove the [$i] following $GroupNote_ClientID=$_POST['Client_No'], I'll get all three digits, but only from the first checkbox row selected: array(3) { [0]=> string(22) "(1518-R, 4, This note)" 1=> string(22) "(1534-R, 3, This note)" [2]=> string(22) "(4062-R, 3, This note)" }

In any case, nothing is getting inserted into the table. Depending on the variable syntax, the PHP error log shows "Undefined variable: insertGroup" and/or "Undefined variable: insertGroup".

Also, I'm aware of the dangers of $_POST variables. My database is an internal-use only, on our intranet. No outside access.




Decoding exponential formula in VB

I am working on a program that allows the user to set an automatic task to run at certain times.

Here is an example of what the day of week selection looks like:

enter image description here

Each day is assigned a value of 2 ^ (x - 1), with x being the day number (Sun=1, Mon=2, Tue=3, etc..)

Then, the code goes through and calculates the sum of all the checked boxes to get a single numeric value that is stored in the database.

For example, if all the boxes are checked, the final value would be 1+2+4+8+16+32+64 = 127.

Here's what the VB code looks like:

If mycheckbox.Checked = True Then
    dowVal = dowVal + 2 ^ (x - 1)
End If

This repeats for every checkbox, substituting x for the day number and mycheckbox for each day's unique checkbox id. Once it runs though all 7 days, dowVal is the final value that gets sent to the database.

Generating the dowVal based on the checkboxes is easy enough, but how would I go about reversing this process?

Given a single dowVal, I need to go and programmatically check all the corresponding boxes and produce the exact same combination of checked boxes that were used to generate dowVal in the first place.

I initially tried using the inverse of the IF statement above like so:

 If dowVal = 2 ^ (x - 1) Then
            mycheckbox.Checked = True
 End If

Obviously this only works if a single checkbox is checked because it doesn't account for the summed values.

The only way I can think to do it would be a massive set of IF statements that account for all possible permutations, but this wouldn't work for other portions of the program that use this same formula such as minute of day, because that has 60 checkboxes and the number of combinations would be exponentially insane.

How would I go about decoding dowVal and translating that back into checked boxes that does not involve an exponential amount of cases?




php limite chek box

Hello I need a little help . How to limit these checkbox with php

So is this, but now follows a code block:

if($check_item_ok[8] == '0') { // 0 for Weapons Pendants
            if($item_exc >= '1') {echo'
                            <div class="opt_title">Increases Mana After monster +Mana/8</div>
                            <div class="opt"><input id="ex1" onclick="checkall();" ame="boxes" value="1" type="checkbox"></div>
            ';};
            if($item_exc >= '2') { echo'
                            <div class="opt_title">Increases Life After monster +Life/8</div>
                            <div class="opt"><input id="ex2" onclick="checkall();" ame="boxes" value="2" type="checkbox"></div>
            ';};
            if($item_exc >= '3') { echo'
                            <div class="opt_title">Increase attacking(wizardly)speed+7</div>
                            <div class="opt"><input id="ex3" onclick="checkall();" ame="boxes" value="3" type="checkbox"></div>
            ';};
            if($item_exc >= '4') { echo'
                            <div class="opt_title">Increase Damage +2%</div>
                            <div class="opt"><input id="ex4" onclick="checkall();" ame="boxes" value="4" type="checkbox"></div>
            ';};
            if($item_exc >= '5') { echo'
                            <div class="opt_title">Increase Damage +level/20</div>
                            <div class="opt"><input id="ex5" onclick="checkall();" ame="boxes" value="5" type="checkbox"></div>
            ';};
            if($item_exc >= '6') { echo'
                            <div class="opt_title">Excellent Damage Rate +10%</div>
                            <div class="opt"><input id="ex6" onclick="checkall();" ame="boxes" value="6" type="checkbox"></div>
            ';};




Hold checked items in list view. Searched and searched but no luck or I don't understand

I am trying to have a checked list retain values when scrolling in a listview and then also until the user has chosen to clear the list. I know that this has been asked many times but every answers I've read over the last two days havn't worked for me or I don't understand enough about what I'm doing to get it right (first thing I've developed). I am wondering if anyone can point me in the right direction using my actual code please? Or something that will means something to the code I have. Thank you in advance!

Below is my list code:

public class ShopList {

    public String RecName;
    public String RecIngredient;

    public ShopList(String recName, String recIng) {
        this.RecName = recName;
        this.RecIngredient = recIng;

    }
}

Below is my Custom Adapter:

public class ShoppingListAdapter extends ArrayAdapter<ShopList> {
public ShoppingListAdapter(Context context, ArrayList<ShopList> shoppingLists) {
    super(context, 0, shoppingLists);
}

@Override
public View getView(int position, View convertView, ViewGroup parent) {

    ViewHolder holder;

    ShopList shopList = getItem(position);
    if (convertView == null) {
        convertView = LayoutInflater.from(getContext()).inflate(R.layout.shoppinglist, parent, false);
        holder = new ViewHolder();
        holder.tvRecName = (TextView) convertView.findViewById(R.id.tvRecipeShop);
        holder.tvIngredient = (CheckedTextView) convertView.findViewById(R.id.tvIngredShop);
        convertView.setTag(holder);
    }
    else {

        holder = (ViewHolder) convertView.getTag();
    }

    holder.tvRecName.setText(shopList.RecName);
    holder.tvIngredient.setText(shopList.RecIngredient);
    holder.tvIngredient.isChecked();

    return convertView;

}
    public static class ViewHolder {
    public TextView tvRecName;
    public CheckedTextView tvIngredient;

}


}

And this is the relevant code from my Activity:

public void getListData(){

    lv = (ListView)findViewById(R.id.lvShoppingList);

        ArrayList<ShopList> shopListArray = new ArrayList<ShopList>();

        ShoppingListAdapter myAdapter = new ShoppingListAdapter(this, shopListArray);
        ListView lv = (ListView) findViewById(R.id.lvShoppingList);

        lv.setAdapter(myAdapter);

        Cursor c = myDB.rawQuery("SELECT * FROM ShoppingList", null);

        c.moveToFirst();



        while (!c.isAfterLast()){

            String RecName = c.getString(c.getColumnIndex("RecipeName"));
            String RecIngredient = c.getString(c.getColumnIndex("IngredientName"));

            ShopList sL = new ShopList(RecName, RecIngredient);

            myAdapter.add(sL);

            c.moveToNext();
        }
        c.close();
}

public void toggle(View v)
{
    CheckedTextView cView = (CheckedTextView) v.findViewById(R.id.tvIngredShop);
    if (cView.isSelected())
    {
        cView.setSelected(false);
        cView.setChecked(false);

    }
    else {
        cView.setSelected(true);
        cView.setChecked(true);


    }
}

}

I still have a checkbox in my layout that I have just made invisible for now while I tried to get a solution trying to mimic what the simple_list_item_multiple_choice does. Can always put it back if need be.

I also understand that my SQL query is not the "correct" way of doing things from what I can gather but as a newbie I could recognise what it was doing and it's worked for me so far.

Thank you for your assistance, this has been bothering me for too long now. Also, sorry that I know it's a repeatedly asked question but I am at a loss. Thanks




JQuery checkbox filter parameter

I have list of checkboxes for genre filters. Here is HTML

<div class="gl-title">Türler</div>
<ul class="check-list filters" id="genres">
  <?php foreach($genres as $genre){?>
    <li>
      <div class="customCheck">
        <input type="checkbox" data-genrename="<?php echo $genre->slug; ?>" id="tur_<?php echo $genre->term_id;?>">
        <label for="tur_<?php echo $genre->term_id;?>"></label>
      </div>
      <div class="cl-text">
        <?php echo $genre->name;?>
      </div>
    </li>
    <?php }?>
</ul>
</div>`

On checkbox click i want to add genrename at the end of the url.Here is my JQuery code

$(".customCheck").children("input").unbind(click).click(function(){
    if ($(this).is(":checked")) {
        $(this).prop("checked", false);
    } else {
        $(this).prop("checked", true);
    }
    alert("blabla");
    var curUrl = window.location.href;
    alert(curUrl);

    if(curUrl.substring("?tur=")>-1){
        window.location=curUrl+"+"+$(this).attr("data-genrename");
    }else{
        window.location=curUrl+"?tur="+$(this).attr("data-genrename");

    }

});

"tur" means genre in my language.(For you can understand url.) This function is under document ready.Checking functions are working but i can't see alert box on click. I tried with incognito mode for caches nothing changed. What is problem Thanks so much




how to Save listview checkbox values to sharedpreferences

I have an activity which contains a listview. That listView has a custom adapter, it contains checkBox i want to get checkbox value and save it in sharepreference and show the value in another activity.




checkbox is not getting checked in angular js

<tr ng-repeat="languages in samln">
   <td>
      <span>{{languages.emplang}}</span>
   </td>
   <td>
      <input type="checkbox" name="checkbox1-" id="sp1" value="false" style="margin-left:40px;" ng-model="languages.speak">
   </td>
   <td>
      <input type="checkbox" name="checkbox2-" id="rea1" value="false" style="margin-left:40px;" ng-model="languages.read">
   </td>
   <td>
      <input type="checkbox" name="checkbox3-" id= "wr1" value="false" style="margin-left:40px;" ng-model="languages.write">
   </td>
</tr>

It has two string values true and false. I gave as value="false" but checkbox is not getting checked and Here languages is a list.




How to deny dynamic name generation when creating a checkbox list dynamically

Im creating a checkbox list with HtmlInputCheckBox based on some database entries.

Due to validation purposes it's required that all the checkboxes has the same name.

Unfortunately the name attributes are always dynamically generated.

Any suggestions?

Code:

        foreach (var item in tableItems)
        {
            index += 1;              
            var value = item.GetStringValue("Text", string.Empty);

            var checkbox = new HtmlInputCheckBox();
            checkbox.Name = this.ID;  //<-- This has to be the same for all checkboxes                
            checkbox.Attributes.Add("class", CheckBoxCssClasses);
            checkbox.ID = this.ID + index;
            checkbox.Attributes.Add("value", value);
            if (Required == true)
                checkbox.Attributes.Add("required", "required");
            dynamicCheckboxes.Controls.Add(checkbox);

            var label = new HtmlGenericControl("label");
            label.Attributes.Add("class", LabelCssClasses);
            label.Attributes.Add("for", this.ID + index);
            label.InnerHtml = value;
            dynamicCheckboxes.Controls.Add(label);                
        }




Stored and clear array location

I am using check box using stored value in the array location when select and deselect the check box means to be clear the particular array index value and store the another check box value at the same location.

public class MainActivity extends Activity {

int m[] =new int[5];
int count=1;
int t=0;
CheckBox chk1,chk2,chk3,chk4;
int flag,increment=0;
int b;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    chk1=(CheckBox)findViewById(R.id.checkBox1);
    chk2=(CheckBox)findViewById(R.id.checkBox2);
    chk3=(CheckBox)findViewById(R.id.checkBox3);
    chk4=(CheckBox)findViewById(R.id.checkBox4);
    Button next=(Button)findViewById(R.id.next);
    Button previous=(Button)findViewById(R.id.previous);      
    chk1.setOnCheckedChangeListener(new OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
            // TODO Auto-generated method stub

            if(chk1.isChecked())
            {                                       
                flag=1;
                m[increment]=flag;
                increment++;
                count++;                
            }
            else 
            { increment--;
            count--;        

            }               
        }
    });
    chk2.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
            // TODO Auto-generated method stub
            if(chk2.isChecked())
            {
                flag=2;
                m[increment]=flag;
                increment++;
                count++;
            }
            else        
            {                   
                increment--;
                count--;
            }               
        }
    });
    chk3.setOnCheckedChangeListener(new OnCheckedChangeListener() {

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

            if(chk3.isChecked())
            {
                flag=3;
                m[increment]=flag;
                increment++;
                count++;
            }
            else 
            {       
                increment--;
                count--;
            }
        }
    });
    chk4.setOnCheckedChangeListener(new OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(CompoundButton arg0, boolean isChecked) {
            // TODO Auto-generated method stub
            if(chk1.isChecked())
            {
                flag=4;
                m[increment]=flag;
                increment++;
                count++;        
            }
            else
            {   
                increment--;
                count--;
            }
        }});
    next.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            t++;
            if(t<4)
            {
                switch (t) {
                case 1:
                    b=m[0];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;
                case 2:
                    b=m[1];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;
                case 3:
                    b=m[2];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;
                case 4:
                    b=m[3];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;              
                default:
                    if(t<=3)
                    {
                        t=3;
                    }
                    break;
                }
            }
        }

    });
    previous.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            t--;
            if(t>=0)
            {
                switch (t) {
                case 1:
                    b=m[0];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;
                case 2:
                    b=m[1];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;
                case 3:
                    b=m[2];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;
                case 4:
                    b=m[3];
                    if(b==1)
                    {
                        Toast.makeText(getApplicationContext(), "one", 100).show();
                    }else if(b==2)
                    {
                        Toast.makeText(getApplicationContext(), "two", 100).show();
                    }else if(b==3)
                    {
                        Toast.makeText(getApplicationContext(), "three", 100).show();
                    }else if(b==4)
                    {
                        Toast.makeText(getApplicationContext(), "four", 100).show();
                    }
                    break;              

                default:
                    if(t<=0)
                    {
                        t=1;
                    }
                    break;
                }
            }
        }

    });
}




Symfony2: Set label of checkbox from Class Field

I have a Class with 3 fields:

$id, $name, $isChecked

I have a formtype and I want, that the label of the $id field is the $name field. Is that possible?

/**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('id')
            ->add('name')
            ->add('is_checked', 'checkbox', array(
                'required' => false,
                'label' => //This should be the $name field
            ));
        ;
    }




jeudi 28 janvier 2016

How to show alert message if I hit Submit button directly and need to show json object after clicking for input types and then Submit?

I wanted to show one alert message if I click directly Submit button instead of clicking my <input type="checkbox"> directly only. I have tried it at Fiddle, but it's getting alert message every time(that is if I directly click Submit button - showing alert message and after clicking of any <input type-"checkbox"> and then hitting Submit button - also showing alert message, this time I need to show only json object on console, not alert message). Please help me, thanks in advance.




how to show item selected from dropdown should not appear in checkbox list

enter image description here

On my page there is a dropdown list of items(Main Complaint) and a checkbox list on popup(Additional Complaint) as shown in above image.

Popup checkbox list of Additional Complaint is like below (There are more items in my list so list is in four columns):

enter image description here

HTML code

 <label class="question-name" ng-class="{error:hasError()}">  <span class="ng-binding" ng-hide="question.nameHiddenOnMobile">Main Complaint </span>  <span class="icon-required" ng-show="question.required"></span>  </label>

<select name="Language.PrimarySpoken" ng-hide="showAddAnswer" ng-model="question.response.value" ng-options="a.text as a.getText() for a in question.answers.items" id="Language.PrimarySpoken" ng-value="a.text" class="input-wide " ng-class="{error:hasError()}" ng-change="selectAnswer()">
   <option class="hidden" disabled="disabled" value=""></option>
        <option value="One">One</option>
        <option value="Two">Two</option>
        <option value="Three">Three</option>
        <option value="Four">Four</option>
        <option value="Five">Five</option> 
        <option value="Six">Six</option> 
        <option value="Seven">Seven</option> 
        <option value="Eight">Eight</option> 
</select>


 <label class="question-name" ng-class="{error:hasError()}">  <span class="ng-binding" ng-hide="question.nameHiddenOnMobile">Additional Complaint </span>  <span class="icon-required" ng-show="question.required"></span>  </label>

         <div class="form-row added ng-binding content" ng-bind-html="question.getText()" id="text" ></div>
       <div class="form-row addlink ng-binding" ng-bind-html="question.getText()"><em><a class='inline' href="#inline_content">+ Add/Edit</a></em></div>

  <div style='display:none'>
   <div id='inline_content' style='padding:25px; background:#fff; font-size: 17px;'>
<form action="" id="popup_form">
    <div class="added">

        <div class="column-left">
                <label class="checkbox" for="checkbox1" style="font-size:20px;">
                <input type="checkbox" name="complaint" value="One" id="checkbox1" data-toggle="checkbox">
                One
                </label>
                <br/>
                <label class="checkbox" for="checkbox2" style="font-size:20px;">
                <input type="checkbox" name="complaint" value="Two" id="checkbox2" data-toggle="checkbox">
                Two
                </label>
                <br/>
        </div>

        <div class="column-center">
                <label class="checkbox" for="checkbox3" style="font-size:20px;">
                <input type="checkbox" name="complaint" value="Three" id="checkbox3" data-toggle="checkbox">
                Three
                </label>
                <br/>
                <label class="checkbox" for="checkbox4" style="font-size:20px;">
                <input type="checkbox" name="complaint" value="Four" id="checkbox4" data-toggle="checkbox">
                Four
                </label>
                <br/>
        </div>

        <div class="column-center-right">
            <label class="checkbox" for="checkbox5" style="font-size:20px;">
            <input type="checkbox" name="complaint" value="Five" id="checkbox5" data-toggle="checkbox">
            Five
            </label> 
            <br/>
            <label class="checkbox" for="checkbox6" style="font-size:20px;">
            <input type="checkbox" name="complaint" value="Six" id="checkbox6" data-toggle="checkbox">
            Six
            </label> 
            <br/>
        </div>

        <div class="column-right">
            <label class="checkbox" for="checkbox7" style="font-size:20px;">
            <input type="checkbox" name="complaint" value=" Seven" id="checkbox7" data-toggle="checkbox">
            Seven
            </label> 
            <br/>
            <label class="checkbox" for="checkbox8" style="font-size:20px;">
            <input type="checkbox" name="complaint" value="Eight" id="checkbox8" data-toggle="checkbox">
            Eight
            </label> 
            <br/>
        </div>

    </div> 
<br/>
<input type="submit" name="submit" id="update" class="button button-orange" style="width: 90px; margin-top: 450px;
margin-left: -533px;" value="Update">
<input type="submit" name="cancel" id="cancel" class="button button-orange" style="width: 90px; background-color:#36606e;" value="Cancel">
</form> 

</div>
</div>

Question:

If 'One' item is selected from dropdown list of Main Complaint, then in Additional Complaint checkbox list that 'One' item should not appear like below but the empty space also should not be there.

enter image description here

Can anyone please tell me, how do I get that using Jquery/JS?

Thanks in advance.




Javascript Validation of dropdown menu and text area

I am to set up Javascript to validate required form fields. If a form field is missing a pop-up will come up on users screen. I have been able to figure most of it out however the problem is with the check-box. If the user does not click a check-box they are to get an error message. The way I have my code written, if the user checks "monday" the form is processed, but if they check any other days except monday then they will still get the error message, any thoughts?

function checked() {
  var userName = document.getElementById("text").value;
  var userPhone = document.getElementById("phone").value;
  var checkBoxCheck = document.getElementById("checkers").checked;
  var otherOne = document.getElementById("dropdown").value;
  var addInfo = document.getElementById("textarea").value;
  if (userName == "" || userPhone == "" || checkBoxCheck == "") {
    alert("Please fill in: name, phone number, days of week.");
    if (otherOne == "Other") {
      if (addInfo == "") {
        alert("Please fill in your additional information.");
      }
    }
    return false;
  } else {
    return true;
  }
}
<body>
  <div class="container-fluid">
    <div class="page-header">
      <table border="1" width="100%" Frame="below">
        <thead>
          <h1 style="color:purple" align="center"><span>C</span>aFe 80's</h1>
        </thead>
      </table>
    </div>
    <table border="0" width="20%" cellspacing="20">
      <ul class="list-inline nav nav-tabs">
        <li><a href="Lab-9CSSHomePageV6.html"><span class="glyphicon glyphicon-home"></span></a>
        </li>
        <li><a href="Lab-9CSSMenuPageV6.html">Menu</a>
        </li>
        <li class="active"><a href="Lab-9CSSContactPageV6.html">Contact Us</a>
        </li>
      </ul>
    </table>
  </div>
  <div class="container" style="height: 700px; position: relative; top: 60px">
    <form onsubmit="return checked()" action="lab-9CSSContactPageV6.html" method="POST">
      <div class="form-group">
        <label for="text">Name:</label>
        <input type="text" class="form-control" id="text">
      </div>
      <div class="form-group">
        <label for="email">Email address:</label>
        <input type="email" class="form-control" id="email">
      </div>
      <div class="form-group">
        <label for="phone">Phone Number:</label>
        <input type="phone" class="form-control" id="phone">
      </div>
      <div class="form-group">
        <label for="dropdown">Reason for Inquiry:</label>
        <select class="form-control" id="dropdown">
          <option>Catering</option>
          <option>Private Party</option>
          <option>Feedback</option>
          <option id="oOther">Other</option>
        </select>
      </div>
      <div class="form-group">
        <label for="textarea">Addition Imformation:</label>
        <textarea class="form-control" rows="5" id="textarea"></textarea>
      </div>
      <div class="form-group" style="position:relative; right: 40px">
        <div class="radio-inline">
          <label class="radio-inline">Have you been to the restaurant?</label>
          <label class="radio-inline">
            <input type="radio" name="rad" checked>No</label>
          <label class="radio-inline">
            <input type="radio" name="rad">Yes</label>
        </div>
      </div>
      <div class="form-group" style="position:relative; right: 40px">
        <div class="checkbox-inline">
          <label class="checkbox-inline">Best days to contact you:</label>
          <label class="checkbox-inline">
            <input id="checkers" type="checkbox" value="">M</label>
          <label class="checkbox-inline">
            <input id="checkers" type="checkbox" value="">T</label>
          <label class="checkbox-inline">
            <input id="checkers" type="checkbox" value="">W</label>
          <label class="checkbox-inline">
            <input id="checkers" type="checkbox" value="">TH</label>
          <label class="checkbox-inline">
            <input id="checkers" type="checkbox" value="">F</label>
        </div>
      </div>
      <div class="form-group" align="center">
        <button type="submit" class="btn btn-default">Send Request</button>
      </div>
    </form>
  </div>



How to store input type checkbox into json object using either Javascript or jQuery?

I wanted to store all my clicked input accordions(<input type="checkbox">) into json object, I have tried it but it is storing/taking the last input accordion clicked event only, it is not storing/taking all the input clicked accordions that is whatever I click on any accordion(of <input type="checkbox">) that should store into json object using either Javascript or jQuery ? I am not sure where I am doing wrong ? Please help me regarding this ? Thanks in advance. I have created fiddle.




Using checkbox's to construct URL then generate query with controller

I am trying to generate a URL dependent on which checkbox is checked, so on the click of a checkbox a URL is generated with parameters that I can grab and construct a query for a symfony controller. So Far I only have the html with basic php

<div class="side-bar">
        <h3>Categories</h3>
        <form >
            <?php foreach ($article_cats as $category) {
                        ?> <input type="checkbox" name="category[]" value="<?php echo $category['id'] ?>"> <?php
                }
            ?>
        </form>
</div>

Then I am trying to use jQuery/javascript to grab the values from the form but I cant seem to get any results

<script src="//code.jquery.com/jquery-1.12.0.min.js"></script>

<script>
$(document).ready(function () {

    var categories = [];

    // Listen for 'change' event, so this triggers when the user clicks on the checkboxes labels
    $('input[name="cat[]"]').on('change', function (e) {

        e.preventDefault();
        categories = []; // reset

        $('input[name="cat[]"]:checked').each(function()
        {
            categories.push($(this).val());
        });

    });

// get data from array 
// construct url
// send to controller

});


</script>

Once I have the parameters, should be simple enough to generate the query for the controller. I just dont have any idea how construct the URL




Event to some dynamically generated checkbox issue

My english is not good but I need help please!!!

I am dynamically adding rows to a table, add textbox and checkbox's.

In the change function I want: When the first checkbox is marked the others are disabled and the texbox change their value

The updatebox function It works perfectly for each generated row, but change function only it works with the first.

function agregar(){
var fila = $('<tr></tr>');
var columna = $('<td></td>');
var input = $('<input type="text" />').attr({name: 'idiomas_usu[]',  id:'list1'});
columna.append(input);
input = $('<input type="checkbox" />').attr({name: 'dos', class:'cb2', id:'cb2' });
columna.append(input);
input = $('<input type="text" />').attr({name: 'idiomas_usu[]', id:'list2'});
columna.append(input);
input = $('<input type="checkbox" />').attr({name: 'dos', class:'cb2',  id:'cb3' });
columna.append(input);
input = $('<input type="text" />').attr({name: 'idiomas_usu[]', id:'list3'});
columna.append(input);
input = $('<input type="checkbox" />').attr({name: 'dos', class:'cb2', id:'cb4' });
columna.append(input);
input = $('<input type="text" />').attr({name: 'idiomas_usu[]', id:'list4'});
columna.append(input);
input = $('<input type="checkbox" />').attr({name: 'dos', class:'cb2', id:'cb5' });
columna.append(input);
fila.append(columna);
$('#tab_logic').append(fila);
}

function updateBox(event){
  var input = $(this).prev();
        if(this.checked) {
    input.val("1");
    }
  else {
    input.val("");
  }
}

 $('#boton').click(agregar);
 $('#tab_logic').on('click', '.cb2', updateBox);

function change(event){
var $this = $(this);
if ($this.is("#cb2")) {
    if ($("#cb2:checked").length > 0) {
        $("#cb3").prop({ disabled: true, checked: false });
          $("#cb4").prop({ disabled: true, checked: false });
             $("#cb5").prop({ disabled: true, checked: false });
             $("#list2").prop({ disabled: true, value: '' });
             $("#list3").prop({ disabled: true, value: '' });
             $("#list4").prop({ disabled: true, value: '' });

    } else {
        $("#cb3").prop("disabled", false);
        $("#cb4").prop("disabled", false);
        $("#cb5").prop("disabled", false);
    }
   } 
 }

Here's the code running: JSfiddle

Please help me!!!!




Error with html checkbox value retrieval

In my html I have:

<div id="case_filter" style="float: bottom">
   <input type="checkbox" name="bC" value="B C" checked> No B C<br>
   <input type="checkbox" name="fN" value="f NC" > No F NC<br>
   <input type="checkbox" name="rR" value="RR" > No RR<br>
</div>

I kept the first checkbox checked by default. I want to access the value of the checkbox in my JS. I am doing this below, but it returns null (when I console.log it).

 var checkedValue = document.querySelector('.bC:checked').value;




Enlarging Check boxes in continuous form

I am trying to increase the size of checkboxes through the use of wingdings by using this method.

Private Sub Form_Current()   
If Me.chkVerify = True Then   
lblLargeCheck.Caption = Chr(252)   
Else   
lblLargeCheck.Caption = " " ' a space
End If
End Sub

Private Sub lblLargeCheck_Click()
[chkVerify] = Not ([chkVerify])
If [chkVerify] = True Then
lblLargeCheck.Caption = Chr(252)
Else
lblLargeCheck.Caption = " " ' a space
End If
End Sub

Here is the error that i run into: enter image description here

Notice the first check box is marked and the label check box has been all checked. Is there a work around this problem? I only want the large checkbox to be shown for a particular row only if the checkbox is marked. I will be hiding the checkbox at the end.




Jasmine Having Trouble Detecting A Checkbox

As part of a larger batch of Jasmine testing, I'm trying to detect whether a box is checked. However, I can't figure out how to get Jasmine to properly detect if a box is checked. Either that, or I can't figure out how to properly check it with jQuery. The following test fails:

it('detects when a checkbox is checked', function() {
  form.affix('input').addClass('checkbox');
  $('.checkbox').prop('checked', true);
  console.log ($('.checkbox').prop('checked'));
  console.log ($('.checkbox').is(':checked'));
  expect($('.checkbox').is(':checked')).toBeTruthy();
});

The Console log shows a true and then a false, which means that there's definitely a property named "checked" with a value of true, but that's not the same as it being :checked.

I tried Googling "use jquery to check a checkbox" and found all kinds of people saying that to check a checkbox, you use the prop() method. Some of those answers were right here on Stack Overflow.

Clearly, I'm doing something wrong. I just need help figuring out what it is. Can anyone help?




How to send checkbox value in remote validation

I have a form with 2 fields, a textbox and a checkbox, the textbox has jquery remote validation via Remote attribute setted in the model.

ViewModel

public class ViewModel
{
    [Remote("IsValid", "About", AdditionalFields = "Ok")]
    public string Name { get; set; }

    public bool Ok{ get; set; }
}

View

@model ViewModel
<form id="foo" action="@Url.Action("F")" method="POST">
    @Html.TextBoxFor(model => model.Name)
    @Html.CheckBoxFor(model => model.Ok)
   <input type="submit"/>
</form>

When the textbox changes remote validation is triggered but the ajax request always sends the original value of the checkbox when the page loaded no matter if it changed.

I made a test where the additional field was a textbox also and the problems doesn't occur, it seems to be a checkbox problem.

Is that a design issue of jquery remote validation? Is there a workaround to achieve this?




How to submit a checkbox only when it is checked, only unchecked and both when checked or unchecked

There are 3 possible behaviours someone might want from a input[type="checkbox"]

  1. submit value when input[type="checkbox"]:checked,
  2. submit value when input[type="checkbox"]:not(:checked)
  3. submit value when input[type="checkbox"] checked or unchecked

1. Submit when checked

This is the behaviour most people would want which is lucky because this is the elements default behaviour.

2. Opposite submit when unchecked use case

Assume you created a form with all fields checked by default

<input type="checkbox" checked value="1" name="1" />Check me if Yes
<input type="checkbox" checked value="1" name="2" />Check me if Yes
...
...
<input type="checkbox" checked value="1" name="49" />Check me if Yes
<input type="checkbox" checked value="1" name="50" />Check me if Yes

we created the form so we know the default values.

It would make sense to submit and process(server) only the changed values. In this case its the unchecked checkboxes.

This is alternative of using a double negative and submitting normally.

<input type="checkbox" value="0" name="1" />Check me if No
<input type="checkbox" value="0" name="2" />Check me if No
...
...
<input type="checkbox" value="0" name="49" />Check me if No
<input type="checkbox" value="0" name="50" />Check me if No

3. Submit when checked or unchecked

This might be used if there were two possible values you might want to send to the server.

<input type="checkbox" default="NO" value="YES" />Check me if YES

Number 1. is pretty straight forward but believe it or not this is a question on stackoverflow.

<form>
  <input name="checkbox" type="checkbox" value="1" checked />
</form>

So how to achieve the other two?




jquery change first part of input value with dropdown value

My html:

<table>
    <tr>
        <td>
          <input type="checkbox" name="checkbox[]" value="Volvo,4 wheels, hardtop"/>
        </td>
        <td>
            <select>
                <option value="volvo">Volvo</option>
                <option value="saab">Saab</option>
                <option value="opel">Opel</option>
                <option value="audi">Audi</option>
            </select>
        </td>
    </tr>
    <tr>
        <td>
          <input type="checkbox" name="checkbox[]" value="Volvo,4 wheels, hardtop"/>
        </td>
        <td>
            <select>
                <option value="volvo">Volvo</option>
                <option value="saab">Saab</option>
                <option value="opel">Opel</option>
                <option value="audi">Audi</option>
            </select>
        </td>
    </tr>
</table>

I want the first word of the value in the checkbox to be the same as the word selected in the dropdown. But only in the same row. So if the value in the dropdown of the first row is 'Saab', the value in the second row shouldn't be automatically 'Saab' but could be a different value. How can i do this?




Filter using Checkboxes

i have this website http://ift.tt/1Pl0gUJ

As you can see i have two tables. What i need, if it is possible, is to hide and display the tables in the same position using some checkboxes like "table 1" and "table 2".

I think that i have to put the 2 tables in the same <div> and then?

Have you some tip?

Thanks in advice




Enable combobox when checkbox is checked

How to enable combobox when checkbox is checked? Any suggest? Help pleasee.




What is the correct way to submit only unchecked checkboxes and the correct way to submit both checked and unchecked

I would like to know the correct approach to submit unchecked checkboxes only(opposite of default behaviour)

Why?

If all checkboxes are checked by default, lets say 50 of them. It only really makes sense to submit changed values, in this case only the unchecked checkboxes need to be posted.

I would like to know the correct approach to submit a checkbox regardless of whether it is checked or not.

Why?

I would like a default value to be submitted it a checkbox was not checked.

Please no answers which are dependent on a specific server-side language see here




s:checkbox fieldValue always true in validation before submitting

I am using Struts 2 <s:checkbox /> in my form processing, along with AngularJS and jQuery. Before submitting, I need validation and until now we do this in the project:

When we press Submit button, this function is called:

$scope.processForm('myForm', '<s:url value="/form/validate.action" />', '<s:url value="/form/save.action" />');

,where processForm(formId, validateUrl, submitUrl) is a funtion defined by us:

$scope.processForm = function(form, validateUrl, submitUrl) {
        window.scroll(0,0);
        ProccessFormService.processStandarForm(form, validateUrl, submitUrl);
    };

And furthermore, we have processStandarForm() defined in a global service:

angular.module('ourApp').controller('myFormCtrl', function($scope, $modal, ProccessFormService) {
...
}

In service:

(function() {

angular.module('ourApp').factory('ProccessFormService', ['$http', function($http) {

    processStandarForm: function(form, validateUrl, submitUrl) {        
            this.processForm(form, validateUrl, submitUrl);
        },

    processForm: function(form, validateUrl, submitUrl, success) {

            if ((typeof form) == 'string') {
                form = document.getElementById(form);
            }

            var data = this.form2Object(form);
            var ctrl = this;

            if (data) {
                if (validateUrl) {
                    $http({
                        method  : 'POST',
                        url     : validateUrl,
                        data    : $.param(data),  // pass in data as strings
                        headers : { 'Content-Type': 'application/x-www-form-urlencoded' }  // set the headers so angular passing info as form data (not request payload)
                    }).success(function() {
                        if (!success) {
                            form.action = submitUrl;
                            form.submit();
                        } else {
                            ctrl.submitAjaxForm(submitUrl, data, success)
                        }
                    });
                } else if (submitUrl) {
                    if (!success) {
                        form.action = submitUrl;
                        form.submit();
                    } else {
                        this.submitAjaxForm(submitUrl, data, success)
                    }
                }
            }       
        },



}

Basically, we are submitting twice the form, firstly for validation, then for submitting.

What I don't understand, is that if I debug in action class, in the function of validate(), the boolean value of <s:checkbox /> is always true, but in submit() function, boolean values are submitted correctly, according to they are checked/not checked. Checkboxs are like this:

<div class="col-sm-12 form-checkbox">
     <s:checkbox name="myForm.married" ng-model="checkboxModel" value="<s:property value='%{myForm.married}'/>"  ng-change="submitCheckbox();" ng-init="checkboxModel= %{myForm.married}" theme="simple"  ng-disabled="anotherFunction()" />
</div>

I understand that, the value submitted is fieldValue="xxx" in <s:checkbox />, and by default is true. So I did this to change the fieldValue of every checkbox before the page is loaded. Although all the script are executed, nothing changed. I still get all true in validation.

$(document).ready(function(){
$( "input:checkbox" ).each(function(){
        var checkbox = $(this);
        var checked = checkbox.prop("checked");//sera false/true
        if (checked == true){
            checkbox.prop("fieldValue", "true");
        } else {
            checkbox.prop("fieldValue", "false");
        }
    });
});

So, how can I get right boolean values not only in submitting, but also in validation?? Is the Angular service wrongly written?? I really doubt that but I am not able to figure out the question. Please help and thanks.




Symfony2: FormType Collections as Checkboxes

I have a model CostTypeConnection which has an one to many relation to DepartmentConnection.

I want, that the DepartmentConnection is displayed as checkboxes.

My CostTypeConnection Class has a variable $costType, which is an Entity CostType, that has a $name varaible in it.

My DepartmentConnection Class has a variable $department, which is an Entity Department, that has also a $name variable.

My CostTypeFormType:

  ....    
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('costType', 'text', array(
                'label' => 'costType'
            ))
            ->add('departmentConnections', 'collection', array(
                'type' => new DepartmentConnectionType(),
                'allow_add'    => false,
                'label' => false,
                'by_reference' => false,
                'options' => array('label' => false),

            ))
        ;
    } ...

My DepartmentConnection:

...
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('department', 'text', array(
                'label' => false
            ))
        ;
    }...

So it is not possible to define a checkbox-Type in my Formbuilder for department, because it is an entity and not a variable. Has someone an idea what I can do? This doesnt work in my DepartmentConnectionType Class:

public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('department', 'choice', array(
                'label' => false
            ))
        ;
    }

It finishs with the error:

The value of type "object" cannot be converted to a valid array key

THANKS FOR ANY HELP!!!




inserting multiple checkboxes into one column but in multiple rows

I have a page with multiple checkboxes. My code inserts each checkbox into a separate column, although this is causing issues when I am looking to pull information out again.

I had previously been able to insert into one column but the answers all went into one field rather than separate rows. I also need the user_id of the user logged in to insert into each row for each box checked as well.

Can anyone please copy and amend my code to be able to insert into one column (response) and into separate rows, along with the user_id.

Here is my code, thank you

<?php  
session_start();
include_once 'dbconnect.php';

if(!isset($_SESSION['user']))
{
 header("Location: index.php");
}
$res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);

if(isset($_POST['submit']))
{  
header("Location: eNISATVids.php");

@$userID=$_SESSION['user'];
@$checkbox1=$_POST['Log'];
@$checkbox2=$_POST['Worktray'];
@$checkbox3=$_POST['Visual'];
@$checkbox4=$_POST['ChangePd']; 
@$checkbox5=$_POST['Logout'];
@$checkbox6=$_POST['ClientSearch'];
@$checkbox7=$_POST['StartAssessment'];
@$checkbox8=$_POST['Finalise'];
@$checkbox9=$_POST['Print'];
@$checkbox10=$_POST['Hcn'];
@$checkbox11=$_POST['Lcid'];
@$checkbox12=$_POST['Soscare'];
@$checkbox13=$_POST['Reassign'];
@$checkbox14=$_POST['Close'];

    $query="INSERT INTO enisatanswer (user_id,Log,Worktray,Visual,ChangePd,Logout,ClientSearch,StartAssessment,Finalise,Print,Hcn,Lcid,Soscare,Reassign,Close) VALUES 
    ('$userID', '$checkbox1', '$checkbox2','$checkbox3', '$checkbox4', '$checkbox5', '$checkbox6','$checkbox7', '$checkbox8','$checkbox9', '$checkbox10','$checkbox11', '$checkbox12', '$checkbox13', '$checkbox14')";  
    mysql_query($query) or die (mysql_error() );
if($query==true)
   {  
      echo'<script>alert("Your choices have inserted Successfully \n \n Please click on Display eNISAT Tutorials at the buttom of the page to view your videos ")</script>';  
   }  
else  
   {  
      echo'<script>alert("Failed To Insert")</script>';  
   }  
}  
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome - <?php echo $userRow['username']; ?></title>
/<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="header">
 <div id="left">
    <label>NHSCT eNISAT Tutorials</label>
    </div>
    <div id="right">
     <div id="content">
         Welcome <?php echo $userRow['forename']; ?>&nbsp;<a href="logout.php?logout">Sign Out</a>
        </div>
    </div>
</div>
<br>
<p align="center"><img src="title.jpeg" width="400"height="100" alt="title.jpeg">
<br>
<br>
<center>
<h2>Please select the tasks you require assistance with, before clicking DISPLAY ENISAT TUTORIALS:<h2>
<br>
<table align="center" height="0" width="70%" border="1" bgcolor = "white">
   <form  action="" method="post"

   <tr> 
      <td colspan="2">Tick each relevant box:</td>  
   </tr>  
   <tr>  
      <td>How to login</td>  
      <td><input type="checkbox" name="Log" value="1"></td>   
   <tr>  
      <td>How to manage your worktray</td>  
      <td><input type="checkbox" name="Worktray" value="1"></td>  
   <tr>  
      <td>How to change your visual settings (Colours and text size)</td>  
      <td><input type="checkbox" name="Visual" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to change your own password on the system</td>  
      <td><input type="checkbox" name="ChangePd" value="1"></td>  
   </tr>  
   <tr>  
      <td>How to logout of the system</td>  
      <td><input type="checkbox" name="Logout" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to search for a client on the system</td>  
      <td><input type="checkbox" name="ClientSearch" value="1"></td> 
   </tr>  
   <tr> 
      <td>How to start an assessment</td>  
      <td><input type="checkbox" name="StartAssessment" value="1"></td> 
   </tr>  
   <tr>
      <td>How to finalise an assessment</td>  
      <td><input type="checkbox" name="Finalise" value="1"></td>  
   <tr>  
      <td>How to print an assessment</td>  
      <td><input type="checkbox" name="Print" value="1"></td>  
   </tr>  
   <tr>  
      <td>How to create a client and referral manually through Find on H+C</td>  
      <td><input type="checkbox" name="Hcn" value="1"></td>  
   </tr>  
   <tr>  
      <td>How to submit a referral from LCID (LCID Users only)</td>  
      <td><input type="checkbox" name="Lcid" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to submit a referral from Soscare (Soscare Users only)</td>  
      <td><input type="checkbox" name="Soscare" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to reassign a referral on eNISAT</td>  
      <td><input type="checkbox" name="Reassign" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to close a referral on eNISAT</td>  
      <td><input type="checkbox" name="Close" value="1"></td>
   </tr> 
   <tr>  
      <td  <td><button name="submit" type="submit" onclick="window.location.href='eNISATVids.php'">Display eNISAT Tutorials</button></td>
</tr> 
</table>  
</div>  
</form>  
</body>  
</html> 




Javascript code for automatically checking a checkbox based on clicking a field

I have a digital signature box on my form (in Acrobat) and would like a checkbox to be automatcally checked, once a user clicks on this signature box in order to sign the form. Can someone please help with the javascript coding required for this, thanks.




ACF PRO 5 add active class to checked items

I'm using ACF Pro. I have created custom field called "Items", it is a checkbox field. Inside that i have four checkbox items "First, second, third and fourth"

Now, i need to print out all checkbox values and assign a class only to checked items.

So, if i check "First" then it will get a class, others are not getting anything, but are still printed out in a list.

With ACF instructions i can print out only one, checked item, but i need to have all items printed out all the time. All checked items will get a custom class to mark it checked.

ACF manual is here: http://ift.tt/1Mvpkb5

Is it possible to achieve?




Swift - iOs 8 - UIAlertView with checkbox

I'm trying to make an UIAlertView with checkboxes in it. Is there a way to do that ? (I am not forced to use an alert, it can be whatever sort of popup, it juste need to be small and to not switch the view)

PS: I'm open to any kind of library (Like somthing on cocoapods, or github..)




mercredi 27 janvier 2016

ComboBox with checkbox as dropdown

I am working in a winform application where I want to have a Combobox and it's dropdown should contain checkboxes like this:

enter image description here

These checkboxes are search conditions and I must be able to handle the check/Uncheck event of the checkboxes.

Any help or way to do !!!




JavaScript Alert on Check-box Loop

I have a problem in my code.

I want to write a code of java alert while checkbox is not checked.

I have a loop of checkboxes

here is code

 <?php 
 for ($i=0; $i<count($chk); $i++) {

 echo "<input type='checkbox' name='pr' value=''/>".$chk[$i];
 echo "</br>";

 }
?>

and here is JavaScript

<script>

var tags = document.getElementsByName('pr'),
    value = '', i = 0;

for( ; i < pr.length; i++ )
{
    if( pr[i].checked=='' ) {

alert("Please Check All Checkboxes");
    }
}
    </script>

I want that the checkbox which are echo from loop is all checked then is proceed it to next page. If anyone checkbox is not checked it show an alert message

Problem: If i am not checked anyone checkbox it proceed, and i want it would not proceed if anyone checkbox is not checked




jQuery - Check if a group of Check Boxes are checked

How do I check if any of the Check Boxes in chkInv* (chkInv1 and chkInv2) are checked and exclude chkUnrelated.

<label for="chkInv2-0">
  <input name="chkInv2" id="chkInv2-0" type="checkbox" value="1">
  chkInv2
</label>

<label for="chkInv2-1">
  <input name="chkInv2" id="chkInv2-1" type="checkbox" value="2">
  chkInv2
</label>

<label for="chkInv3-0">
  <input name="chkInv3" id="chkInv3-0" type="checkbox" value="3">
  chkInv3
</label>

<label for="chkInv3-1">
  <input name="chkInv3" id="chkInv3-1" type="checkbox" value="4">
  chkInv3
</label>

<label for="chkUnrelated">
  <input name="chkUnrelated" id="chkUnrelated-1" type="checkbox" value="4">
  chkUnrelated
</label>

My current code checks all the Check Boxes of the page.

var checkBoxes = $('input:checkbox:checked').length;

Can I use some kind of regular expression?

var checkBoxes = $('input:checkbox[name=chkInv*]:checked').length;




How can you iterate through ng-models within an ng-repeat in an angular controller?

I am pretty new to web dev and trying out angular so there may be many mistakes.. Basically I have a ng-repeat within an ng-repeat and I need to set a model variable within the child repeat onclick of a checkbox in parent repeat. I don't know how to access the models in the child from the parent. I have tried by giving an [$index] but it does not work.

Here is my HTML. I have a parent checkbox which should change the clicked boolean variable of child checkboxes onclick.

<li ng-repeat="set in wordlistSets" ng-controller="setController">

<div class="parentSelector">
<span class="selectorLeft">
    <p> blah </p>
</span>

<span class="selectorRight">
    <input type="checkbox" name="sets" ng-click="selectAll()">
</span>
</div>

<div  ng-repeat="wordlist in set.content"  ng-click="checked[parent.$index][$index] = !checked[parent.$index][$index]">
<span class="selectorLeft">
    <p>more blah</p><br>
    <p>extra blah</p>
</span>

<span class="selectorRight">
    <input type="checkbox" name="wordLists" ng-click="checked[parent.$index][$index] = !checked[parent.$index][$index]" ng-model="checked[parent.$index][$index]">

</span>
</div>

The "SelectAll()" function should iterate through wordlists and toggle the checked variable accordingly. I cant use angulars ng-checked because I need it to toggle and not have the same state as the parent checkbox allways since it can also be set by clciking on the div itself.

Here is the controller.

myApp.controller("setController", function MyController($scope) {
$scope.parentChecked = false;

$scope.selectAll = function() {
    for (var i = 0; i < $scope.set.content; i++) {
        if ($scope.parentChecked) {
            $scope.checked[$scope.index][i] = true;
        } else {
            $scope.checked[$scope.index][i] = false;
        }
    }
}

Here is a picture for reference. Clicking on either the pink selector or the black parent-selector should tick the checkbox. Picture of page setup

Thanks in advance for any help! :D




Vertically Align Bootstrap Checkbox

I'm trying to vertically align checkboxes for a column of checkboxes + labels. Ideally, I'd like the elements to be in the center of the page but with the checkboxes themselves vertically aligned.

<div class="row">
  <div class="span12 pagination-centered">
  <div class="checkbox">
    <label><input type="checkbox" value="">asdfasdf</label>
  </div>
    <div class="checkbox">
    <label><input type="checkbox" value="">sdfasdf</label>
  </div>
  <div class="checkbox">
    <label><input type="checkbox" value="">asfdasdf</label>
  </div>
  <div class="checkbox">
    <label><input type="checkbox" value="">asdfasdf</label>
  </div>
 </div>
</div>



How do I get CheckBox Value when checked and when unchecked the value disappear?

I'm using if else statement to show data(value) in the Chart area when my checkbox is checked and data to disappear from chart when I uncheck the checkbox,

I been trying with Visible , enable, checked; however, when I used visible my checkbox disappeared not my data from chart..when its false and if I use enable, I can't click my checkbox when its false.

this is my code, can anyone please help? Is there other way to solve this problem? seriesXOneLine is my chart data Name

        void chkXOneValue_CheckedChanged(object sender, EventArgs e)
    {
        CheckBox chkXOneValue = sender as CheckBox;
        Series seriesXOneLine = new Series();
        seriesXOneLine.ChartType = SeriesChartType.Line;
        chartTrend.Series.Add(seriesXOneLine);
        chartTrend.Series[0].Name = "X1";
        seriesXOneLine.XValueMember = "Row";
        seriesXOneLine.YValueMembers = "X1";
        seriesXOneLine.Color = Color.Blue;
        if (chkXOneValue.CheckState == CheckState.Checked)
        {
            chkXOneValue.Visible = true;      
        }
        else
        {
            chkXOneValue.Visible = false; 
        }

    }




query to display video links from a table which match inserted checkbox values in another table

I need help with a query which I do not have the knowledge to implement. I am aware that mysql functions are deprecated but my website is only a prototype so it is not important for the purpose of this project.

I have a site which is used to display video tutorials for users for training purposes. Users are presented with list of 14 questions with checkboxes, they can tick the relevant checkboxes and view each associated tutorial on the next page.

The user_id of the person logged on also inserts into my database so I can identify who has selected the checkboxes, along with each checkbox value (1 or 0) into a seperate column in my answers table (enisatanswer). Here is my code for inserting which is working fine. The SELECT statement at the start is to maintain my SESSION details of the user, and is used across each page.

<?php  
session_start();
include_once 'dbconnect.php';

if(!isset($_SESSION['user']))
{
 header("Location: index.php");
}
$res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
$userRow=mysql_fetch_array($res);

if(isset($_POST['submit']))
{  
header("Location: eNISATVids.php");

@$userID=$_SESSION['user'];
@$checkbox1=$_POST['Log'];
@$checkbox2=$_POST['Worktray'];
@$checkbox3=$_POST['Visual'];
@$checkbox4=$_POST['ChangePd']; 
@$checkbox5=$_POST['Logout'];
@$checkbox6=$_POST['ClientSearch'];
@$checkbox7=$_POST['StartAssessment'];
@$checkbox8=$_POST['Finalise'];
@$checkbox9=$_POST['Print'];
@$checkbox10=$_POST['Hcn'];
@$checkbox11=$_POST['Lcid'];
@$checkbox12=$_POST['Soscare'];
@$checkbox13=$_POST['Reassign'];
@$checkbox14=$_POST['Close'];

    $query="INSERT INTO enisatanswer (user_id,Log,Worktray,Visual,ChangePd,Logout,ClientSearch,StartAssessment,Finalise,Print,Hcn,Lcid,Soscare,Reassign,Close) VALUES 
    ('$userID', '$checkbox1', '$checkbox2','$checkbox3', '$checkbox4', '$checkbox5', '$checkbox6','$checkbox7', '$checkbox8','$checkbox9', '$checkbox10','$checkbox11', '$checkbox12', '$checkbox13', '$checkbox14')";  
    mysql_query($query) or die (mysql_error() );
if($query==true)
   {  
      echo'<script>alert("Your choices have inserted Successfully \n \n Please click on Display eNISAT Tutorials at the buttom of the page to view your videos ")</script>';  
   }  
else  
   {  
      echo'<script>alert("Failed To Insert")</script>';  
   }  
}  
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome - <?php echo $userRow['username']; ?></title>
/<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="header">
 <div id="left">
    <label>NHSCT eNISAT Tutorials</label>
    </div>
    <div id="right">
     <div id="content">
         Welcome <?php echo $userRow['forename']; ?>&nbsp;<a href="logout.php?logout">Sign Out</a>
        </div>
    </div>
</div>
<br>
<p align="center"><img src="title.jpeg" width="400"height="100" alt="title.jpeg">
<br>
<br>
<center>
<h2>Please select the tasks you require assistance with, before clicking DISPLAY ENISAT TUTORIALS:<h2>
<br>
<table align="center" height="0" width="70%" border="1" bgcolor = "white">
   <form  action="" method="post"

   <tr> 
      <td colspan="2">Tick each relevant box:</td>  
   </tr>  
   <tr>  
      <td>How to login</td>  
      <td><input type="checkbox" name="Log" value="1"></td>   
   <tr>  
      <td>How to manage your worktray</td>  
      <td><input type="checkbox" name="Worktray" value="1"></td>  
   <tr>  
      <td>How to change your visual settings (Colours and text size)</td>  
      <td><input type="checkbox" name="Visual" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to change your own password on the system</td>  
      <td><input type="checkbox" name="ChangePd" value="1"></td>  
   </tr>  
   <tr>  
      <td>How to logout of the system</td>  
      <td><input type="checkbox" name="Logout" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to search for a client on the system</td>  
      <td><input type="checkbox" name="ClientSearch" value="1"></td> 
   </tr>  
   <tr> 
      <td>How to start an assessment</td>  
      <td><input type="checkbox" name="StartAssessment" value="1"></td> 
   </tr>  
   <tr>
      <td>How to finalise an assessment</td>  
      <td><input type="checkbox" name="Finalise" value="1"></td>  
   <tr>  
      <td>How to print an assessment</td>  
      <td><input type="checkbox" name="Print" value="1"></td>  
   </tr>  
   <tr>  
      <td>How to create a client and referral manually through Find on H+C</td>  
      <td><input type="checkbox" name="Hcn" value="1"></td>  
   </tr>  
   <tr>  
      <td>How to submit a referral from LCID (LCID Users only)</td>  
      <td><input type="checkbox" name="Lcid" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to submit a referral from Soscare (Soscare Users only)</td>  
      <td><input type="checkbox" name="Soscare" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to reassign a referral on eNISAT</td>  
      <td><input type="checkbox" name="Reassign" value="1"></td> 
   </tr>  
   <tr>  
      <td>How to close a referral on eNISAT</td>  
      <td><input type="checkbox" name="Close" value="1"></td>
   </tr> 
   <tr>  
      <td  <td><button name="submit" type="submit" onclick="window.location.href='eNISATVids.php'">Display eNISAT Tutorials</button></td>
</tr> 
</table>  
</div>  
</form>  
</body>  
</html> 

My next page at present displays links in a table for all 14 of my videos from my questions table 'enisatquestion'.

My question is, can anyone help me with a query to only display the video links for the the checkboxes that were selected by the user, instead of them all. I am guessing that in order to do this a variable would need to be created for each column from my 'enisatanswer' table. My columns are (Log,Worktray,Visual etc)

So my query i presume would be something like:

SELECT * FROM enisatquestion WHERE enisatanswer (Log,Worktray,Visual....) VALUES =1 and user_id = $userID=$_SESSION['user'];

I am really not sure about this Statement

Any help would be greatly appreciated. Here is my code to display my videos

<?php  

    session_start();
    include_once 'dbconnect.php';

    if( !isset( $_SESSION['user'] ) ) header("Location: index.php");

    $res=mysql_query("SELECT * FROM users WHERE user_id=".$_SESSION['user']);
    $userRow=mysql_fetch_array( $res );

    $query = "SELECT eNISATQuestion, eNISATVideo FROM enisatquestion";

    $result = mysql_query( $query );
    /* A default message if the query fails or there are no records */
    $enisatquestion='<h2>Sorry, there are no records</h2>';


    /* you cannot output content outside the html tags, not valid ~ it will work but NO */
    if( $result ) {/* if there is a recordset, proceed and generate html table */
        $enisatquestion = "<table >";
        while ( $row = mysql_fetch_assoc($result) ) {
            $enisatquestion .= "<tr><td><a href='{$row['eNISATVideo']}'>{$row['eNISATQuestion']}</a></td></tr>";
        }
        $enisatquestion .= "</table>";    
    }
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ift.tt/kkyg93">
<html xmlns="http://ift.tt/lH0Osb">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome - <?php echo $userRow['username']; ?></title>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body>
<div id="header">
 <div id="left">
    <label>NHSCT eNISAT Tutorials</label>
    </div>
    <div id="right">
     <div id="content">
         Welcome <?php echo $userRow['forename']; ?>&nbsp;<a href="home.php?home">Return to Homepage</a>&nbsp;&nbsp;<a href="logout.php?logout">Sign Out</a>
        </div>
    </div>
    <br>
    <br>
    <br>
    <br>
<p align="center"><img src="title.jpeg" width="400"height="100" alt="title.jpeg">
<br>
<br>
    <center>
   <h2>Click on the each link to open your tutorial in Windows Media Player<h2>
   <br>
    <?php
        /* output the html table here, below your header */
        echo $enisatquestion;
        /*
            If the query failed then the default gets displayed
        */
    ?>  
</div> 
</body>  
</html>