Ask a Question related to Macromedia ColdFusion, Design and Development.

  1. #1

    Default Checkbox problem

    Hello,

    I would like to solve the following problem :

    I've a web site with ex. 5 checkboxes
    Each checkbox contains the name of a certain task
    ex.
    asp:Checkbox 1: Task 1
    asp:Checkbox 2: Task 2
    ...
    asp:Checkbox 5: Task 5

    Each time a task is finished on the server I would like to
    inform the user that the task is finished by checking the checkbox to true
    (Checked = True)
    But I only see those checkboxes checked when the last tast is finished
    (Then I see all 5 checkboxes checked)

    How can I force my website to show each checkbox checked when a task
    is finished ?

    I'am using asp.net with Visual Studio 2003

    Many thanks !


    JIM Guest

  2. Similar Questions and Discussions

    1. Flash ASP Checkbox Problem
      hi all, i need to know how to send the value of a checkbox located into flash mx movie to an asp page that insert the input fields and the...
    2. Howto bind CheckBox to the datagrid/ Then update the database field when the checkbox is clicked.
      I am trying to update the database field when the checkbox is clicked. I am trying to modified the following solution but.. got stuck on the...
    3. Checkbox in DataGrid Problem
      may i please to share a source code to this problem i have a problem to realize this
    4. datagrid - dropdownlist - checkbox problem
      Dear ASP.NET Programmers, I have the following problem. I have a datagrid (ID: grdAllActions). This datagrid has two template columns: one column...
    5. problem retrieving value from DB into a checkbox
      I am very new to ASP/DB, so please bear with me. In my "add data" form, through checkboxes I am entering "Yes" values. (no "No" values, those are...
  3. #2

    Default RE: Checkbox problem

    It depends on how you are using the code..
    usually if I am trying to do something like this, I dont think there will a
    problem..
    what I will do in the most simplest way, is to chek the box and make a
    postback, and its done!
    Maybe you can tell us a bit more about how YOU are trying to achieve this by
    posting some code or putting ur concept down here...
    Hth...
    R. Thomas
    R. Thomas, aka Xtreme.Net Guest

  4. #3

    Default Checkbox Problem

    I have a system that lets admin users select from a list of reports what
    certain users can see. They do this by ticking checkboxes, this then enters
    permissions into a database table. My problem now is that I need to let admin
    edit the permissions. I'm a little stuck how to go about doing this so any
    help would be great. Here is my code DB etc. <!--- Reports Table, this
    produces a list and the admin can tick if they want a user to see the report
    ---> <CFquery name='Get_dirs' datasource='tns'> Select * from directories_tbl
    Where Parent_id = 2 </CFquery> <!--- We then output this so the admin can pick
    what user has access to what report ---> <cfoutput> <input type='hidden'
    name='user_id' value='#url.user_id#'></cfoutput> <cfoutput query='get_dirs'>
    <tr> <td width='20'><input type='checkbox' name='dir_id' value='#dir_id#'></td>
    <td> <div align='left'>&amp;nbsp;#ucase(DIR_NAME)#</div></td> </tr></cfoutput>
    This then gets inserted into the permissions table, this all works fine, the
    problem is when I want to edit. <cfloop index='i' from='1'
    to='#ListLen(form.dir_id)#'> <!--- Now insert each permission into the database
    for the user. ---> <cfquery datasource='TNS'> INSERT INTO
    static_perm_tbl(user_id, parent_id) VALUES (#form.user_id#,
    #ListGetAt(form.dir_id, i)# ) </cfquery> </cfloop> So now I want to output
    the first query and populate it with the results from the static_perm_tbl . . .
    .. any ideas? Regards Craig

    craig_uk Guest

  5. #4

    Default Checkbox problem

    Hi everyone,

    How to loop through the checkbox which is inside a datagrid?

    Thanks,
    May
    May 2008 Guest

  6. #5

    Default Re: Checkbox problem

    What are you looking to do? Just a though. I use a class for the lineItem (
    that I write with an member variable for each column ) and a list of those for
    the dataprovider. That way I can dig through the data without dealing with the
    datagrid at all. It also make moving the data around easier. Instead of reading
    out each line into something else, you just send the list of lineItems.

    Izzy1138 Guest

  7. #6

    Default Re: Checkbox problem

    Hi,

    Thanks for your reply. What I want to do is shown below. And the datagrid is
    shown below:

    |---------|----------------|----------------|
    | id | Checkbox | TextInput |
    |---------|----------------|----------------|
    | 1 | false | |
    | 2 | true | Create |
    | 3 | true | Update |
    |---------|---------------|----------------|

    What I want to do is loop through the checkbox which is inside a datagrid. If
    it is true, then get the id value and TextInput value out from the datagrid.
    And then update the database.

    Thanks,
    May


    May 2008 Guest

  8. #7

    Default Re: Checkbox problem

    Hi,

    One solution to your problem could be:
    - Create a class "myItem" representing one line of information with 3
    attributes: id (int), checked(boolean) and textValue(String)
    - Create an arrayCollection which will be the dataprovider of your datagrid.
    This arrayCollection will contains object of type "myItem".
    - In the item renderer of the column with the checkbox, on the CheckBox
    object add a change listener like this id="chkbox" change="(this.data as
    myItem).checked = chkbox.selected"

    When you want to check if there is something checked, you don't use the
    datagrid anymore but simply go through the arrayCollection you gave as a
    dataprovider.

    Hope it's clear.

    David

    David M.. Guest

  9. #8

    Default Re: Checkbox problem

    [q]Originally posted by: David M..
    Hi,

    One solution to your problem could be:
    - Create a class "myItem" representing one line of information with 3
    attributes: id (int), checked(boolean) and textValue(String)
    - Create an arrayCollection which will be the dataprovider of your datagrid.
    This arrayCollection will contains object of type "myItem".
    - In the item renderer of the column with the checkbox, on the CheckBox
    object add a change listener like this id="chkbox" change="(this.data as
    myItem).checked = chkbox.selected"

    When you want to check if there is something checked, you don't use the
    datagrid anymore but simply go through the arrayCollection you gave as a
    dataprovider.

    Hope it's clear.

    David[/q]

    Hi David,

    Thanks for your help! I am new to Flex. If possible, please give me sample
    code. Thanks again!

    May

    MayLam18 Guest

  10. #9

    Default Re: Checkbox problem

    Hi,

    I did the following quick and didn't test it but I guess it should work.

    Good luck,
    David


    // FIle MyItem.as
    package
    {
    public class MyItem
    {
    public var itemId:int;
    public var checked:Boolean;
    public var textValue:String;

    public function MyItem()
    {
    }


    }
    }

    //Your main application .mxml
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
    xmlns:local="*">

    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    private function displayChecked():void {
    var res:String = "";
    for each ( var item:MyItem in myDataProvider) {
    if ( item.checked ) {
    res += item.itemId + " " +item.textValue + "\n";
    }
    }
    Alert.show(res);
    }
    ]]>
    </mx:Script>

    <mx:ArrayCollection id="myDataProvider">
    <local:MyItem itemId="1" checked="false" textValue="text value 1" />
    <local:MyItem itemId="2" checked="false" textValue="text value 2" />
    <local:MyItem itemId="3" checked="false" textValue="text value 3" />
    <local:MyItem itemId="4" checked="false" textValue="text value 4" />
    <local:MyItem itemId="5" checked="false" textValue="text value 5" />
    </mx:ArrayCollection>

    <mx:VBox width="100%" height="100%" horizontalAlign="center"
    verticalAlign="middle">
    <mx:DataGrid dataProvider="{myDataProvider}">
    <mx:columns>
    <mx:DataGridColumn dataField="itemId" headerText="itemId"/>
    <mx:DataGridColumn dataField="checked" headerText="checked">
    <mx:itemRenderer>
    <mx:Component>
    <mx:Canvas>
    <mx:CheckBox id="checkBox"
    selected="{(data as MyItem).checked}"
    change="{(data as MyItem).checked = checkBox.selected}" />
    </mx:Canvas>
    </mx:Component>
    </mx:itemRenderer>
    </mx:DataGridColumn>
    <mx:DataGridColumn dataField="textValue" headerText="textValue"/>
    </mx:columns>
    </mx:DataGrid>

    <mx:Button click="displayChecked()"/>
    </mx:VBox>


    </mx:Application>

    David M.. Guest

  11. #10

    Default Re: Checkbox problem

    That's great. Thanks a lot David. I will try your code later.

    May
    May 2008 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139