Hi,
I'm using CMSMS 1.12.
I'm busy developing a module for a customer.
I created a UDT that can be called in the content of a page to display specific info about a product.
From the UDT I call a form so that the product can be ordered. Everything has to happen within the UDT.
The form I created is not made with FormBuilder. I programmed it myself and called it action.orderform.php. It's using orderform.tpl as template.
Calling the form directly on a page works fine. It gets processed on submit.
Calling the form from the UDT and displaying it via the UDT on the page, I keep being sent back to the Home page on submit.
What did I do wrong?
I hope someone can help me.
Thanks in advance.
Form integration in UDT
Form integration in UDT
- Attachments
-
[The extension txt has been deactivated and can no longer be displayed.]
-
[The extension txt has been deactivated and can no longer be displayed.]
-
[The extension txt has been deactivated and can no longer be displayed.]
-
- Support Guru
- Posts: 8169
- Joined: Tue Oct 19, 2004 6:44 pm
- Location: Fernie British Columbia, Canada
Re: Form integration in UDT
Please read the module writing tutorial (Advanced section on the docs site).
If you have a module like this, that you are authoring then you should almost never need to use UDT's like this. You may just need to create more actions.
It may be different if you are trying to work with somebody else's module... but if it's your own module, it shouldn't be necessary.
Also, your form handling can be done in the same action/controller that outputs the form, it's cleaner and simpler this way.
Also, it is bad form to output HTML like that from within PHP code. That is what smarty templates are for. Your PHP code should just provide data to smarty, that you then format within the template.
If you have a module like this, that you are authoring then you should almost never need to use UDT's like this. You may just need to create more actions.
It may be different if you are trying to work with somebody else's module... but if it's your own module, it shouldn't be necessary.
Also, your form handling can be done in the same action/controller that outputs the form, it's cleaner and simpler this way.
Also, it is bad form to output HTML like that from within PHP code. That is what smarty templates are for. Your PHP code should just provide data to smarty, that you then format within the template.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Re: Form integration in UDT
When you call a module action from a page you are passing the proper variables to the action for the page. But by default those aren't passed to the UDT and then not passed when calling your action.chunteler wrote: Calling the form from the UDT and displaying it via the UDT on the page, I keep being sent back to the Home page on submit.
I agree with Calguy1000, UDT are for small pieces of code and it sounds like you have passed that point.
Re: Form integration in UDT
Thanks Jeff and Calguy1000!
I'm new to CMSMS and I thought I had to use a UDT because the customer wanted me to use a tag. Now I'm reading your reactions I realize I can do that in a much easier way with actions.
Thanks also for your feedback on Smarty.
I'm new to CMSMS and I thought I had to use a UDT because the customer wanted me to use a tag. Now I'm reading your reactions I realize I can do that in a much easier way with actions.
Thanks also for your feedback on Smarty.