Help with Form Customization -- I'm stumped

Hi folks, I have hit a wall with a particularly vexing problem I’m having with one of my websites, even though the exact same implementation and configuration works flawlessly on a separate site.

I’m using Form Customization to simplify adding a particular type of content to the site since my client will probably be doing this routinely. In this case, it’s adding events to an event calendar page.

I have created a Profile named “Event Calendar”. Within it, I have created two actions – “Create Resource” and “Edit Resource.” These actions each have a constraint field of “parent” and the corresponding parent’s ID as the constraint. (The parent is a container.) The template is “Event Calendar Template,” and I have specified the template ID. I have customized how the UI appears, removing anything not absolutely necessary to complete the task, and all of these are active. I have also set “enable_template_picker_in_tree” to NO.

However, when I attempt to create a new event in the folder, the regular default new document screen is what I see. But if I select the “Event Calendar Template” from the template picker, the screen THEN refreshes to show the UI specified in Form Customizations.

Any idea why this would happen? (Also, I’m testing this as Administrator/Super User, so I don’t believe this would be a permissions issue and, as I said, this exact same setup works flawlessly on another site.)

I’m using Modx 3.1.2 in both cases. I’ve cleared the cache (including deleting everything in the core/cache folder) and logged out and back in and nothing works.

I suppose it could be some Extra that’s interfering with this, but I can’t imagine which one. And no errors in the error log, either.

Anyway, I’m so stumped after working on this for hours. If anyone has any good insights, I’d really appreciate it!

Thanks,
Michael

A couple of thoughts:

First, even though you are the admin/super user, you’re still subject to permission issues unless you are a sudo user. So edit your profile, make yourself a sudo user, clear the cache manually and see if it makes a difference.

Second, take a look at the all your plugins and see if any are attached to any manager-page events. Or just disable all but the one you’re working on (by right-clicking on them in the Elements tree.). Clear cache again. If that fixes things, you can re-activate the plugins on-by-one until things break to find the culprit.

In the Form Customization Set, did you specify a “Default Value” for the row “template” in the grid of the tab “Set Information and Fields”?

Thanks for the recommendations. I was/am set to sudo, and disabling plugins had no impact, unfortunately. Also, SiteCheck gives everything a clean bill of health.

Yes, definitely – it is set to the template I want to be the default. Currently, when I attempt to create an item in the container, it defaults to the parent’s template instead.

I should also add, I have tried completely deleting the customization, clearing the cache, logging out, and then rebuilding it from scratch with no luck.

When you run the following SQL-statement (for example in phpMyAdmin), do you get a result?

SELECT `modActionDom`.*
FROM `modx_actiondom` AS `modActionDom` 
JOIN `modx_fc_sets` `FCSet` ON `modActionDom`.`set` =  `FCSet`.`id` 
JOIN `modx_fc_profiles` `Profile` ON FCSet.profile = Profile.id 
LEFT JOIN `modx_fc_profiles_usergroups` `ProfileUserGroup` ON Profile.id = ProfileUserGroup.profile 
LEFT JOIN `modx_fc_profiles` `UGProfile` ON UGProfile.id = ProfileUserGroup.profile 
WHERE  ( 
	( `modActionDom`.`action` = 'resource/create' 
	AND `modActionDom`.`name` = 'template' 
	AND `modActionDom`.`container` = 'modx-panel-resource' 
	AND `modActionDom`.`rule` = 'fieldDefault' 
	AND `modActionDom`.`active` = 1 
	AND `FCSet`.`active` = 1 
	AND `Profile`.`active` = 1 )
);

If not, what part of the WHERE-clause do you have to delete to get a result?


There is no caching involved here (as far as I can tell).

I got this:

MySQL returned an empty result set (i.e. zero rows). (Query took 0.0028 seconds.)

Does this return a result?

SELECT `modActionDom`.*
FROM `modx_actiondom` AS `modActionDom` 
WHERE  ( 
	`modActionDom`.`action` = 'resource/create' 
	AND `modActionDom`.`name` = 'template' 
);

If not, what is the content of the table modx_actiondom?

That query returned two results…

id set action name description xtype container rule value constraint constraint_field constraint_class active for_parent rank
Edit Copy Delete 1289 5 Resource/Create template NULL modx-panel-resource fieldVisible 0 13 parent MODX\Revolution\modResource 1
Edit Copy Delete 1290 5 Resource/Create template NULL modx-panel-resource fieldTitle 9 13 parent MODX\Revolution\modResource 1

There should be another row with the value fieldDefault in the column “rule”.

It looks to me that in the row “template” (in the MODX manager), you set the column “Label” (to 9) instead of the column “Default Value”.

1 Like

Ah! And I even wear glasses! What a dingus mistake. THANK YOU. If I had paid closer attention I might have caught that the 9 was in the wrong column.

Now I have a different problem, however: When I attempt to create an item using the form customizations (which appear as expected now), I can’t save them. I get no error message, either (visibly or in the log). When I close it, I get the “You have unsaved changes, do you wish to cancel anyway” message, and if I say Yes we go back to the home screen.

I have been careful to make sure all the settings I have in my other client’s configuration (that works) are the same, but for some reason it will not actually create the object.

Open the developers tools in the browser and go to the “Network” tab.
When you click the “Save” button, a new AJAX-request should get created (with the request parameter “action” = Resource/Create). Is that request successful?
If not, what is the response code and the response of this request?

1 Like

This was interesting. So, when I try to save it I get nothing. It just adds “index.php” as the lastest action. When I tested this in my other client’s site, it definitely showed action=Resource/Create, along with a lot of other indications that it was actually creating and saving an object (which it did). Not sure what this implies, though. (Again, no errors in the log.)

I CAN create other objects in the site without issue, btw.

In DEv. tools, did you click on index.php and look at the payload and the response?

1 Like

Aha! And there it is: an unseen error message indicating that a required field had not been completed. That field – “Alias” – was hidden by design, but I forgot to change the system setting for “Automatically generate alias” to “YES.”

Problem solved, gentlemen. Thank you so much for your help and reminding me of these really helpful troubleshooting tools!