I have multiple pages which can take the create flow or the edit flow depending on the user action. Here is what I do:
1. I set a variable called "mode" to session storage. It may take a value "create" or "edit" depending on which button was clicked.
2. In the first form page, there are 2 fields, say "name" and "description". It needs to be populated from database if it's an edit flow or it'll be blank if it's create flow
3. To handle this, I have 2 formulae, 1 for name, 1 for description
4. I call them populateName and populateDescription. I use DefaultTo and use a GET API's response against 0 and leave it blank for 1. Meaning, if the API responds with a value, that'll be populated, else it will be blank
5. If the user wants, he/she can change the existing value and click on Submit
6. I have two variables "name" and "description". On change event of the textbox, I set event.target.value to these variables.
7. On Form submit, I check the mode and branch out to POST or PUT flow
8. It branches out perfectly. In the PUT API, in the Body section, I set an object with name and description as keys and set the values (as set in Step 6)
9. When I submit the form, it invokes the PUT request, the problem I face is, it does not send the updated value in Name and Description textboxes, it sends the populated value.
10. I'm not binding the variables to the text boxes, since I have different flows which is why I do Step 6 explicitly
What am I missing? Can someone help please?