What is the best way to create a form with a confirmation page? - typo3

I would like to create the following form:
Step 1: The user enters his contact details.
Step 2: A confirmation page, where the user has the possibility to confirm or edit his entered data again (back to step 1)
The contact details are stored in an entity domain object. The properties have annotations for validation.
My problem:
When I pass the contact object to the confirmation page, I get the message
Could not serialize Domain Object Vendor\Extension\Domain\Model\Object. It is neither an Entity with identity properties set, nor a Value Object.
I understand that I cannot pass a non-persistent domain object. A tip I found was to convert the object to an array and back again later. This works to display the input on the confirmation page. But if the user edits the data, I lose the validation functionality when converting to an array.
Another possibility would be to persist the object already after step 1 (temporarily?) . The problem here is that the data must not be displayed in the backend (they are not yet confirmed). In addition, unused data is created if the user cancels the process.
Is it possible to save objects temporarily?
What is the most elegant solution to this problem?

If you only wan't to create a form, why don't you use a form plugin like Ext:form or Ext:powermail? These have a summary page by default. And you have the possibility to write the entered data into you're database.

Related

How to populate fields of an online form

I created a custom record (child of Inventory item) and an online form.
The final goal it's to send a link to a user (not a netsuite user) to display the different informations of this custom record. The user will be able to update some values and submit the form.
I saw it's possible to link a script file to this form, but I need the ID of the record to load it and populate every field of the form.
With normal forms, we have the internalid of the record as an URL param but in this case there is nothing in the URL .
Do you know any way to achieve that ?
A solution for the final goal could be:
Create an empty Suitelet (provides external link for User). Or refer to step 4 for contents.
Stored on the Custom record or via script (created in step 3) you can add to the external link, to include the record type and id as url parameters (&recordtype=customrecord&recid=12345). Be sure to avoid reserved parameter names.
Create a UserEvent, Client, or Scheduled Script to send email to User based on your requirements (in the email include the custom external suitelet link). User will click on the link and land on a NetSuite looking webpage (not requiring credentials).
Modify empty Suitelet. Suitelet should when context.request.method===GET: get parameters, load record(s), get data from record(s), create form, display data to User, display fields for User to enter data, add submit and refresh/cancel button, write/display the form with all fields. Upon submission (when context.request.method is not GET) you can use record.submit method to update the custom record(s).
NetSuite Suite Answer Id 74607 has a Sample Custom Form Suitelet Script from that can be very helpful.

Best frontend practice for saving object to a backend before or after creation

situation: Lets's think about basic process of object creation on a client (with CRUD backend).
Let's imagine that we have two "Create" buttons on a page.
first case:
Clicking on the first button will cause to redirect to /create route, where our form located.
After we fill the form with data, we post it to a backend and it retrieves an id of a newly created object.
second case:
Clicking on the second button will cause to send creation request to the backend, then after we got a new object id, we will be redirected to /edit/:id, where our form located (same form).
After we fill the form with data, we send it to a backend and save already existed object (post by id).
question:
What's the pros and cons of those two cases, when to use each of them?
In the first case you can include the validation of the fields in the time of creation
and you only need to create an insert so one database call.
In the second case you are creating an empty entry that will appear in the grids of an application with no data.
Also if your database has required fields, you have to fill them with default data.
Validation will be more difficult since you need to allow empty ex Mobile in data entry
while phone might be required.
Another problem with this is that that you are basically doing two operations. One if for the Insert of the row and one is for the update of the row
However this methodology is easier to implement the live update of text when typing so any disconnects etc will not lose any data. This methodology is also good for collaboration between two clients using websockets ex inserting the row at the same time.

How to get existing value from form to another magento 1.9

I have two different forms , one including user information and the second one have a grid. What I need to do is to get the email from first form to use it in the controller of the 2nd, there is a way or I need to get the value again from database?
you can try sending the email value through ajax when it is set to the other controller by adding parameters in the url or u can store email in a table(hope both tables are for same product or customer) and load it in other form using the id.
Hope it helps....

Is there a way to remove field value using model in CakePHP?

I'm developing an application in CakePHP 2.7 and I have a form where that sends off an Ajax request from a file input and returns some information. This information is then stored inside a hidden form field.
I have a custom validation rule that checks against the hidden field and another to see if both have been submitted as the system can only handle one. When the validation rule returns false it flags up an invalidate message to notify the user of the issue. However now I am left with an issue where the hidden field still contains a value and so does the other field the user filled out but I can't remove the value from the hidden field.
Is there any way I can remove the value from the hidden field inside the model?
I have looked at this question on StackOverflow but it wasn't successsful in helping and dates back to an earlier version of CakePHP based on the date of the question.

asp.net MVC QueryString

project type is MVC2. Let say that i have page1. after success it write somethink to row and get new inserted row id and redirect to another page and sends row id as parameter. and user can see this parameter on querystring. and can change it. i think so taht it is problem in some situation(pages). i use for it a hidden input and after post checking parameter from query string with hidden input value. if they are not equal then writing in to log and redirectiong to error page. does my way is correct. or have a good methods.
thanks...
Exposing IDs like this is pretty standard and is what lets browser bookmarking of specific items work. Your job is to ensure that the user can only see and modify records that they should be able to.
If the user does some URL-hacking and enters the URL to an item they are not allowed to see or modify, you can either just kick them back to the parent page, or give an Access Denied message, depending upon the app/context.
The bottom line is never trust user input, including hidden form parameters.