We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37729
    • 19 Posts
    Hi There,

    Is there a way to limit the amount of rows a user can add to a MIGx table? Or a way to prevent them adding more than x KB of data?

    My client has a fairly large site using MIGx, and the user is data entry happy, occasionally putting more data in than the system is capable of holding. What then happens is the database truncates the data and they get errors. MIGx is brilliantly useful, it'd just be great to stop them putting in more than they should be.

    They're not technical, so it'd be great if this could be implemented, I can potentially do this myself if given a nudge in the right direction. Apologies if this has already been asked or I'm missing something very simple smiley

    Environment:

    MODX Revolution 2.1.3-pl (traditional)
    MIGx 1.1.0
    PHP Version 5.3.8
    MySQL 5.1.56

    [ed. note: toasteddigital last edited this post 14 years, 8 months ago.]
      • 36686
      • 165 Posts
      MIGX does also work on Revolution 2.0.8 with limited functionality. (for example no input-properties - use properties instead!)

      Can you give an example of how to use MIGX with 2.0.8? For example how to create a simple table with two text columns?
        • 4172
        • 5,888 Posts
        Quote from: orbitalalliance at Jan 08, 2012, 06:07 PM
        Hey Bruno, Ya I grabbed your latest commits on those files before I started testing it out.

        Would it use a different base path in the migx form compared to the migx grid view? Seems like it is using the same base path but I am not sure. It's weird that the image renders with the correct path on the migx form but not the migx grid. Maybe I am missing something. I just upgraded to 2.1.5pl to see if it was something with modx itself. I am thinking about upgrading to 2.2.0pl2 but I am not sure that is going to make a difference.

        Any other ideas of what it could be?

        This should be fixed now:
        https://github.com/Bruno17/multiItemsGridTV/commit/3a20731415577b3c9fdd6bfbc1612dd73023b62b
        and
        https://github.com/Bruno17/multiItemsGridTV/commit/10bef376929813a22b5a52b57000ad198f6d998e
          -------------------------------

          you can buy me a beer, if you like MIGX

          http://webcmsolutions.de/migx.html

          Thanks!
          • 4172
          • 5,888 Posts
          Quote from: sketchi at Jan 10, 2012, 04:30 AM
          MIGX does also work on Revolution 2.0.8 with limited functionality. (for example no input-properties - use properties instead!)

          Can you give an example of how to use MIGX with 2.0.8? For example how to create a simple table with two text columns?

          you can import this to the MIGX-tv properties (from your local machine) as an example:
          https://github.com/Bruno17/multiItemsGridTV/blob/master/core/components/migx/examples/example.properties.before.2.1.js
            -------------------------------

            you can buy me a beer, if you like MIGX

            http://webcmsolutions.de/migx.html

            Thanks!
            • 4172
            • 5,888 Posts
            Quote from: toasteddigital at Jan 09, 2012, 04:05 AM
            Hi There,

            Is there a way to limit the amount of rows a user can add to a MIGx table? Or a way to prevent them adding more than x KB of data?

            My client has a fairly large site using MIGx, and the user is data entry happy, occasionally putting more data in than the system is capable of holding. What then happens is the database truncates the data and they get errors. MIGx is brilliantly useful, it'd just be great to stop them putting in more than they should be.

            They're not technical, so it'd be great if this could be implemented, I can potentially do this myself if given a nudge in the right direction. Apologies if this has already been asked or I'm missing something very simple smiley

            Environment:

            MODX Revolution 2.1.3-pl (traditional)
            MIGx 1.1.0
            PHP Version 5.3.8
            MySQL 5.1.56


            there isn't a way (yet) to limit the entries.
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 25803 ☆ A M B ☆
              • 721 Posts
              Updated to MIGx 2.0 on a 2.2rc3 install. Now any MIGx calls only show the first item in the grid. Anyone else have this occur?
                • 4172
                • 5,888 Posts
                what's your snippet-call and what's the output of your MIGX-TV:

                [[*yourMIGXtv]]
                  -------------------------------

                  you can buy me a beer, if you like MIGX

                  http://webcmsolutions.de/migx.html

                  Thanks!
                  • 25803 ☆ A M B ☆
                  • 721 Posts
                  Two Snippet calls.

                  First builds embedded CSS dynamically for a user manageable background image:

                  <style>
                  <!--
                  [[!getImageList? 
                  &tvname=`action`
                  &tpl=`actioncssTPL`
                  &limit=`4`
                  ]]
                  -->
                  
                  </style>
                  


                  Template: actioncssTPL

                  #features .action[[+idx]] {background:url([[+actionicon]]) no-repeat 6px 6px;}
                  


                  Second builds each call to action in an unordered list, which makes it appear as if there are 2 columns for each call to action:

                  <ul id="features">
                  [[!getImageList? 
                  &tvname=`action`
                  &tpl=`calltoactionTPL`
                  &limit=`4`
                  ]]
                  </ul>
                  


                  Template: calltoactionTPL

                  <li class="action[[+idx]] [[!If?&subject=`[[+idx]]`&operator=`inarray`&operand=`2,4`&then=`none`]]">
                      <dl>
                          <dt>[[+actiontitle]]</dt>
                          <dd>[[+actioncopy]]</dd>
                      </dl>
                  </li>
                  


                  MIGX-TV: action
                  Input Type: migx

                  Form Tab:

                  [
                  {"caption":"Call to Action", "fields": [    {"field":"actionicon","caption":"Icon","inputTV":"actionicon"},
                  {"field":"actiontitle","caption":"Heading","inputTV":"actiontitle"},
                  {"field":"actioncopy","caption":"Description","inputTV":"actioncopy"}
                  ]}
                  ]
                  


                  Grid Columns:

                  [
                  {"header": "Icon", "width": "500", "sortable": "false", "dataIndex": "actionicon", "renderer": "this.renderImage"},
                  {"header": "Heading", "width": "500", "sortable": "false", "dataIndex": "actiontitle"},
                  {"header": "Description", "width": "500", "sortable": "false", "dataIndex": "actioncopy"}
                  ]
                  


                  But we reverted to an earlier version for now so I'm afraid troubleshooting might not be possible at this point.
                    • 4172
                    • 5,888 Posts
                    ok, I think that's your issue:

                    with the latest MIGX-versions comes a new field a new autoincrement-field.
                    It's name is MIGX_id.
                    This field isn't in your records before you did't save them all once again.

                    getImageList uses this field by default as key for the output-array.

                    what you can try, is to use this in your getImageList-snippet-call:

                    &placeholdersKeyField = `0`;


                    or
                    &placeholdersKeyField=`idx`


                    I think, I will add a upgrade-script which adds this MIGX-id field to all MIGX-TVs automatically.
                      -------------------------------

                      you can buy me a beer, if you like MIGX

                      http://webcmsolutions.de/migx.html

                      Thanks!
                      • 25803 ☆ A M B ☆
                      • 721 Posts
                      Ok, will try. I'm building some new code in another site with the new version. So basically MIGX_id replaces
                       [[+idx]]
                      ? [ed. note: rx2 last edited this post 14 years, 8 months ago.]

                      This discussion is closed to further replies. Keep calm and carry on.