Handling forn
How can I add a form handler to my module that adds record in database? after adding record it must redirect to same page.
|
form getDefaultParams is not working
I have this model form:
PHP Code:
PHP Code:
This code adds form to page with credit field and with hidden date field, but when I submit form it does not insert date field to sql query, it just uses null, and I get this error An exception occurred while executing 'INSERT INTO xc_order_item_activations (order_item_id, date, credit, activation_code, ip_address) VALUES (?, ?, ?, ?, ?)' with params [null, null, "2", null, null]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'date' cannot be null |
Re: form getDefaultParams is not working
Also tell me please next:
I added multiple forms(as above) on my order page, every order item has its own form, how can I add hidden field to this form that must have valu of order_item_id? |
Re: form getDefaultParams is not working
Quote:
This is because your $schemaDefault describes the "credit" field only, so X-Cart uses "null" value for the rest of the entity fields. You may try to set the missing properties in the View\Model\OrderItemActivation ::setModelProperties() method. Quote:
You can add hidden fields to a form by declaring them in the getDefaultParams() method of your form class that extends \XLite\View\Form\AForm. For example, check the \XLite\View\Form\Profile class. |
All times are GMT -8. The time now is 05:36 PM. |
Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.