Building a CMP without using MIGX

Hey all,

I’m trying to build a CMP for a client and I’m having trouble getting started. The CMP should allow the client to search for a user by email and if that user is found, they can add or subtract points from that user.

I have already created a package that saves points to a user’s account via the ‘web’ section of the website but I can’t figured out how to achieve this same result via the ‘mgr’ section.

Here are steps that I’m trying to achieve:

  1. On the CMP, have a form with an input box that request the user’s email.
  2. On submit, query the database (mod_users I believe) for email address.
  3. If found, return user’s id, display the user’s current points and display a new form asking if you want to add or subtract points.
  4. Enter the amount of points to add/substract, on submit, confirm submission before submission.
  5. Add new row to package by either adding/subtracting from user’s account.

I know this be simple for most but I’m lost when I try to build a CMP within the mgr from the docs. It seems that I have to learn Ext JS (I don’t know it but I’m willing to learn it) to build the form, to submit and query the DB. Is there a simple Ext JS Modx tutorial that has a form submission that I can follow? Or can someone please point me in the direction that I should go?

I’m curious what CMP means.

In MODX terminology, it means Custom Manager Page.

1 Like

Have a look at the update window section of the tutorial:

This allows you to update a record in a grid by sending the new values from ExtJS to the assigned processor (the PHP file server-side).

You don’t have to use Ext.JS in your CMP. Ext.JS is just what MODX uses.
For this use case, it’s probably simpler to use whatever you already use in the frontend.

You can definitely use JQuery or just plain JavaScript for your CMP.

The MyComponent extra will let you edit a config file and then build the CMP for you, but it might be overkill for your use case, and I’m not sure yet how it does in MODX 3. There’s also at least two other CMP-building extras but they haven’t been updated in at least 5 years. There may be others.

Exactly, and it’s probably one of the reason we love MODx so much, you are not forced to do anything any given way, you can go anywhere from using a simple iFrame to go into the whole ExtJS, we even build a CMP using VueJs, you can see the code at GitHub - Trotalo/vlox