Skip to main content
New Hire Training

Get user input


  1. Open Main > Domain Model. The Domain Model in Mendix is your database. Right now, all you should have in the Domain Model is a yellow box with the name "First_name". This box is called an entity. An entity is similar to an object in most programming languages. Right click, then select "Add entity". The entity is blue, which indicates that it is a persistable entity. In other words, this object does not get erased when the program terminates. Yellow entities are non-persistable. Double click the new entity to change its settings.
  2. Change the name to "byu_id".
  3. Check "No" next to "Persistable".
  4. Under attributes, click “New”, then change the name to “Value”. Click “OK”.

    NewHireImage16

    This entity will store the BYU ID of the user, which is what we will ask them to input.

  5. Right click on "Main", then click on "Add page". Change "Page_name" to "BYU_ID_Input". Click "Blank", then "Blank", then "OK". We will come back to this page.
  6. Open your "Home_Web" page that we created earlier. Delete the data view widget we put on the page earlier. We will display different information this time.
  7. Drag a button onto your page.

    NewHireImage17

  8. Double click on the button to change its settings.
  9. Change “Caption” to “Log In”. Under “Events”, change “On Click” to “Create object”. Change “Entity (path)” to “Main.byu_id”. Change “On click page” to “BYU_ID_Input”. Click “OK”.

    NewHireImage18

  10. Open the “BYU_ID_Input” page.
  11. Drag a "Data view" widget onto the page. Double click it. Under "Data source", change "Entity" to "Main.byu_id". Click "OK".
  12. Click “Yes” for “Do you want to automatically fill the contents of the data view?”.
  13. Double click on the form where it says “Value”. Change the “Label caption” to “Enter your BYU ID”.

    Now that the user can input their BYU ID, let’s change the API call we made earlier to get the user’s name. Let’s also store the names of people who use the program in the database (domain model).

  14. Open the Domain Model. Right click, then click "Add entity". Double click the entity to change its settings. Change the "Name" to "User".
  15. Under “Attributes”, click “New”. Change the “Name” to “Name”. Click “OK”.

    NewHireImage19

  16. Click "OK" to save changes. Now we have an entity that will store the names of all the users who enter their BYU ID. These values will be saved on your machine unless you delete them manually.
  17. Let's go back to the "BYU_ID_Input" page. Double click on the "Save" button. Under "Events", change "On click" to "Call a microflow". Change "Microflow" to "Main.REST_Call".

    NewHireImage20

  18. Click "OK" to save changes. Open the "REST_Call" microflow. Add a "Parameter" from the toolbox.
  19. Click "Select" under "Data type" and select "Main.byu_id". We will pass the BYU ID the user inputted as a parameter to this microflow.
  20. Double-click on the "Call REST (GET)" block in your microflow. Let's chang the API URL so your BYU ID isn't hard-coded. Next to "Location", click "Edit...".
  21. Under "Parameters", click "New". Type "$byu_id/Value". In the "Template", replace your BYU ID with "{1}".

    NewHireImage21

  22. Click "OK", then "OK" to save your changes.
  23. Let's fix the error. Click "Security", then "Page access", then click all the boxes next to "BYU_ID_Input". Go to the "Entity access" tab. Click "New", then select "byu_id" and "User". Click "OK". Set these settings:

    NewHireImage22

  24. Click "OK", then "OK" to save the changes.
Previous Topic
Display data on your page
Next Topic
Display the names of everyone who logs in
Was this topic helpful?
Thanks for your feedback.