Adding items to a cfgrid

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

  1. #1

    Default Adding items to a cfgrid

    Hi! I'm trying to add items to a cfgrid using form elements. E.g. I have fname
    textfield, lname textfield, market comboBox, etc in my form I want to have a
    button called 'Add New' (I know the cfgrid has an attribute called insert, but
    i don't want this one) which adds the values that I have input in the form
    fields mentioned above, into the data grid in the appropriate columns. Can
    somebody pls help me with this? Thanks and regards, Yogesh Mahadnac My form
    code is as follows:

    <cfform format="flash" action="process_info.cfm" method="post">

    <cfformgroup type="horizontal">

    <cfformgroup type="hdividedbox">
    <cfinput type="text" name="fname" label="First Name"
    width="100">
    <cfinput type="text" name="lname" label="Last Name" width="100">
    <cfinput type="text" name="email" label="Email" width="100">
    <cfinput type="text" name="userName" label="Username"
    width="100">
    <cfinput type="password" name="userPass" label="Password"
    width="100">
    </cfformgroup>

    <cfformgroup type="hdividedbox">
    <cfselect name="userMarket" query="allMarkets"
    display="mkt_name" value="id_market" queryPosition="below" label="Select
    Market">
    <option value = "">Select One</option>
    </cfselect>
    <cfinput type="button" name="btnAdd" value="Add New"
    onclick="when i click this button i want to add the form values to the grid
    below">
    </cfformgroup>

    </cfformgroup>

    <cfformgroup type="horizontal">
    <cfgrid name="userGrid" selectmode="edit">
    <cfgridcolumn name="fname" header="First Name"
    dataalign="center" width="200">
    <cfgridcolumn name="lname" header="Last Name"
    dataalign="center" width="200">
    <cfgridcolumn name="email" header="Email" dataalign="center"
    width="200">
    <cfgridcolumn name="username" header="User Name"
    dataalign="center" width="100">
    <cfgridcolumn name="pass" header="Password" display="no"
    dataalign="center" width="100">
    <cfgridcolumn name="id_market" header="Market ID" display="no"
    dataalign="center" width="100">
    <cfgridcolumn name="mkt_name" header="Market Name"
    dataalign="center" width="100">
    </cfgrid>
    </cfformgroup>

    </cfform>

    YogeshM Guest

  2. Similar Questions and Discussions

    1. Adding previous and next links in the cfgrid
      I have been reading through a few of these topics, and have not found an answer to this question. Is there built in functionality within MX7 that...
    2. Add Items to CFGrid
      The scenario is simple. I have a textbox where the user enters some value, clicks an "Add" button and I want that value to get added to a CFGrid...
    3. adding list items to a database
      Not sure if this is javascript or php so i put it in both newsgroups, sorry if it's the wrong group. I wrote (with help) a code to put several...
    4. adding items to a list or menu
      Not sure if it is a php question but since i am working in php here it is. Ho can i add items to (the item label=visual text and the value=index...
    5. Adding Attributes to RadioButtonList Items?
      I am trying to use a RadioButtonList bound to a custom datasource to acomplish some user functionality. I want to add various...
  3. #2

    Default Re: Adding items to a cfgrid

    Add the attribute

    insertbutton='Insert button text' to your cfgrid tag.




    <cfgrid name='userGrid' selectmode='edit' insertbutton='Add New' >
    LeftCorner Guest

  4. #3

    Default Re: Adding items to a cfgrid

    Hi! Thanks for replying so soon. Actually , I KNOW there's the inserbutton
    attribute in the cfgrid tag. But I DON'T WANT this insert. I want to add new
    items to the grid from the form elements I created (fname, lname, email,
    userName, etc) to their corresponding fields in the cfgrid. In fact, I DON'T
    WANT TO WORK WITH THE INSERT ATTRIBUTE OF THE CFGRID. I want to be able to add
    items to the datagrid from any other form elements I create. Thanks and
    regards, Yogesh Mahadnac.

    YogeshM Guest

  5. #4

    Default Re: Adding items to a cfgrid

    This will do it.

    <cfinput type="button" name="ins" value="Insert Row"
    onClick="myGrid.insertRow(myGrid);">

    ---nimer

    "YogeshM" <webforumsuser@macromedia.com> wrote in message
    news:d1m8kb$j2k$1@forums.macromedia.com...
    > Hi! Thanks for replying so soon. Actually , I KNOW there's the inserbutton
    > attribute in the cfgrid tag. But I DON'T WANT this insert. I want to add
    > new
    > items to the grid from the form elements I created (fname, lname, email,
    > userName, etc) to their corresponding fields in the cfgrid. In fact, I
    > DON'T
    > WANT TO WORK WITH THE INSERT ATTRIBUTE OF THE CFGRID. I want to be able to
    > add
    > items to the datagrid from any other form elements I create. Thanks and
    > regards, Yogesh Mahadnac.
    >

    Mike Nimer Guest

  6. #5

    Default Re: Adding items to a cfgrid

    sorry, scratch that last post. This is the right code

    <cfinput type="button" name="ins" value="Insert Row"
    onClick="GridData.insertRow(myGrid);">

    ----nimer


    "Mike Nimer" <mnimer@macromedia.com> wrote in message
    news:d1n7nv$97o$2@forums.macromedia.com...
    > This will do it.
    >
    > <cfinput type="button" name="ins" value="Insert Row"
    > onClick="myGrid.insertRow(myGrid);">
    >
    > ---nimer
    >
    > "YogeshM" <webforumsuser@macromedia.com> wrote in message
    > news:d1m8kb$j2k$1@forums.macromedia.com...
    >> Hi! Thanks for replying so soon. Actually , I KNOW there's the
    >> inserbutton
    >> attribute in the cfgrid tag. But I DON'T WANT this insert. I want to add
    >> new
    >> items to the grid from the form elements I created (fname, lname, email,
    >> userName, etc) to their corresponding fields in the cfgrid. In fact, I
    >> DON'T
    >> WANT TO WORK WITH THE INSERT ATTRIBUTE OF THE CFGRID. I want to be able
    >> to add
    >> items to the datagrid from any other form elements I create. Thanks and
    >> regards, Yogesh Mahadnac.
    >>
    >
    >

    Mike Nimer 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