1129

A special welcome to our newest member, Humble-Servant.

Compose Reply

Trongate MX with Desktop App Generated Code

#1
13 Apr 2025, 12:27pm UTC
Sunday 13th April 2025, at 12:27pm UTC
Status: Resolved
I would like to use Tg MX to do form validation on forms created with the Tg desktop app. I have created a module and added the two lines of code as recommended.

The `submit()` method:


The form:


The validation errors do not appear above the `input` fields but instead it open up a json file displaying the errors.
I am suspecting that I need to add some more MX commands to the `$form_attr` and possibly some of the changes in the controller, but sure what is needed.

DC's tutorial, is on a module he built as part of the MX series of tutorials but does not show how it would work on and existing module built with the Tg desktop app. Any help that can be offered would be greatly appreciated.
This post was liked by; DaFa
#2
14 Apr 2025, 2:21pm UTC
Monday 14th April 2025, at 2:21pm UTC
G'day Martin, long time no see.

You are close but no cigar:
1. Skip the $submit === 'Submit' as when the form is submitted via tg_mx the post doesn't include it
2. Here is a modified submit() method of a sample task manager I just created with the Desktop app:
3. and the create form:

Hope that helps

Cheers,
Si
#3
17 Apr 2025, 7:09am UTC
Thursday 17th April 2025, at 7:09am UTC
Hi Simon, yes it been a while since I've been active here since the last time I have no migrated to Zambia (But no-one told me I'd only be getting electricity between 23:00 and 05:00) and have to continually manually by "Bundles" for my data connection. All new wonderful challenges, but back to the business at hand.

Thank you for getting back to me with your solution.
In all the playing around I did previously, at one stage I has the same configuration you showed, but it still was not working. So I have generated a task module, also and updated with your code, however what happens when I press the Submit button, I get redirected back to the homepage. That is for both a correctly filled in form or an empty or erroneous one.

To make a long story short I created a new app and started again and it worked, Hallelujah! I then copied that back to my other app and it did not work.

The long and short of it is, the previous apps were old ones that had been updated many times. The solution start with the latest up-to-date version of the framework.

So once again Simon, thank you.
See you in the next one.
×