Bind Attribute in CheckBox -->Help

Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.

  1. #1

    Default Bind Attribute in CheckBox -->Help

    Hello Everyone,

    I attented a great presentation yesterday by Macromedia Canada.

    I need a little help regarding the BIND attribute.
    I am doing a query from two seperate tables.
    The first query retrieves all the user names.
    The second query searches for language for each user depending on the user_id.

    Attached Code:

    <cfquery name="GetUsers" datasource="DSN1">
    SELECT userid, user_name
    FROM UsersTable
    Order By user_name
    </cfquery>

    <cfquery name="GetLanguage" datasource="DSN2">
    SELECT Language
    FROM LanguageTable
    Where user_id = GetUsers.userid
    </cfquery>

    <cfform method="post" action="Action.cfm" format="flash" skin="halosilver"
    preserveData="yes">

    <cfgrid name="UserGrid" query="GetUsers" rowheaders="no">
    <cfgridcolumn name="user_name" header="First Name" dataalign="center">
    </cfgrid>

    <cfinput type="text" name="firstname" label="Name:"
    bind="{UserGrid.dataProvider[UserGrid.selectedIndex]['user_name']}">
    <cfinput type="checkbox" name="LangEnglish" bind=""> (If the language is
    English then put it to checked = "yes")
    <cfinput type="checkbox" name="LangFrench" bind=""> (If the language is
    French then put it to checked="yes")


    <cfinput type="submit" name="btn" value="Save Data">
    </cfform>


    Thanks in advance guys.


    CF_N_Montreal Guest

  2. Similar Questions and Discussions

    1. bind to a checkbox
      I have a tabbed flash form. the final tab is a summary page of the previous two tabbed pages. The second page lists 10 check boxes. If the...
    2. Bind a textfield with a checkbox
      Hi all, is it possible to bind a textfield with a checkbox. What I am trying to do is, if the checkbox is selected todays date will display in the...
    3. 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...
    4. How to bind checkbox to one of the values of a datagrid
      Hello All, I hope someone can enlighten me, all of the examples and posts Ihave read and sifted through doesn't pertain to what i wouldlike to do...
    5. how to bind data to checkbox in datagrid
      hi i have a datagrid and one colume is a bool if i use a normal asp:BoundColumn is shows as true or false and i want it to show as a checkbox but...
  3. #2

    Default Re: Bind Attribute in CheckBox -->Help

    Also having a similar problem with checkboxes and cfselect using the html option.
    SharedDynamics Guest

  4. #3

    Default Re: Bind Attribute in CheckBox -->Help

    SharedDynamics: Did you find any solutions yet?
    CF_N_Montreal Guest

  5. #4

    Default Re: Bind Attribute in CheckBox -->Help

    Nothing yet, I found something about how to default your select dropdown box
    to the value from a query with the bind attribute. But I can't get that to
    work either.

    I'm frustrated at myself for spending 7 years on CFML and 0 years on
    actionscript.

    SharedDynamics Guest

  6. #5

    Default Re: Bind Attribute in CheckBox -->Help

    Here's the answer with 'English' substituted for your grid value:

    <cfinput type="text" name="firstname" label="Name:" value="English">
    <cfinput type="checkbox" name="LangEnglish"
    visible="{(firstname.text=='English') ? (LangEnglish.selected=true,true) :
    (LangEnglish.selected=false,true)}">
    <cfinput type="checkbox" name="LangFrench"
    visible="{(firstname.text=='French') ? (LangFrench.selected=true,true) :
    (LangFrench.selected=false,true)}">

    Uses the visible value to run the ActionScript.
    (LangEnglish.selected=true,true) sets the checkbox to true and then sets the
    visible attribute to true so the checkbox does not disappear. Notice both
    conditions have the ' ,true' to make sure the checkbox stays visible.

    Hope this helps.




    drforbin1970 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