A form to store information, not ‘submit’ it

0
Hi all, New user learning the ropes with Mendix. I’m trying to find a way where I can basically create a normally looking form with all the usual field types, but when the user ‘submits’ or saves the form, it sends it to the database for storage, but the fields themselves don’t become blank, the user isn’t sent to another page. Instead the data is ‘held’ within the forms and the user can return to edit this data later which will then edit the corresponding data being held in the database. It’s a bit like an address field where some websites ask you amend the form where the address is already pre-filled in the fields and when you ‘submit it’ a popup saying it has been saved appears and this reflects in the form, with the new edit. (I also wonder whether the database stores the versions of the edits as a new row in the entity for which this form is connected to) How an I achieve this?
asked
7 answers
3

Hi Nasser,

Welcome to the Mendix Team.

Yes, You can achieve this scenario easily. 

First, Create an Entity which holds all the attributes ( Form Fields).

Right Click on the entity and Click Generate Overview pages. This will generate Overview and NewEdit pages. 

Then Connect overview page in navigation. Run the app locally.

Click New to add values to all form fields and Click Save to save the data in the database. 

Then Clcik Edit button to edit the form and save it again. This form will hold the already saved data when you try to edit it. 

The following documentation will guide you 

https://docs.mendix.com/howto/data-models/create-a-basic-data-layer

answered
2

Hi Nasser, 

Yes you can add it manually. 

If you refresh the page without saving it will vanish. 

If you saved it already, then you can click it again to see it.

answered
1

Hi Nasser, 

I wonder whether there is a way when I add new attributes to the entity, it reflects this change in the NewEdits page automatically?

No, It wont reflect automatically. Either you need to recreate those pages or Delete the datagrid and dataview from the Overview & Newedit pages and Add them once again. This way, you can add new attributes.

Mendix now saves the contents and keeps me on the page, the data is passed to the database and I can see it in the table view. However, when I return to the form, it is blank once again. I assume this is because the link(s) are set up to send new object? How can I return to the form without having the form reset itself, and carry the latest information within it?

I am not getting your question exactly. Can you add some screenshots to explain it.

answered
1

Hi,

Can you share any video to understand the scenario exactly.

answered
0

(Edited after playing around with this more)

Thank you Arunkumar.

I had created the entity, and attributes and the form already, but I followed your instructions on getting Mendix to re-create these for me via the generate option. There are lots fo attributes so this really is a time saver. I wonder whether there is a way when I add new attributes to the entity, it reflects this change in the NewEdits page automatically?

Mendix now saves the contents and keeps me on the page, the data is passed to the database and I can see it in the table view. However, when I return to the form, it is blank once again. I assume this is because the link(s) are set up to send new object? How can I return to the form without having the form reset itself, and carry the latest information within it?

The table view is good because I have added the created and time date to the first column so if a user edits the existing data, it saves the entire form as a new entry so they have a sort of version history.

I hope that makes sense!

Thank you

answered
0

Hi Arunkumar,

Can I simply manually add in the new attributes too – not having to re-generate the the pages as there is other modifications like additional explanatory  text I have added that won’t come through if they are re-created each time. I am aware how to add the new attribute manually.

On the second point, to rephrase:

After I enter in my data in the form, and hit save it keeps this on the form, and doesn’t reset the fields (as I wanted). When I go to another page, and return back to the form, the data I entered most recently has disappeared (but it obviously still there in the data grid).

[Try opening the attachments in a new tab – they are distorted here even after I entered the new dimensions]

Entering data: 

 

This data is in the data grid:

 

Returning to data form (blank – does not have the data I just entered)

 

answered
0

Thank you for the reply.

So after I click save the text in the fields remains there, but if I navigate away from the page, then return to the page, the form is blank again. Is there a way to keep the text of the last session there?

I think has something to do with the ‘send object’ because every time I go back to the form via the link, it clears the form, BUT if i was to go back with my browser back buttons the data is still there. Is it possible to create a link without the ‘send object’ command so the form retains the data within the fields?

answered