In this chapter we will manipulate the data typed into the edit form - in this case, to ensure that phone number are stored with international format:
Widget Connector | ||||||
---|---|---|---|---|---|---|
|
Update your app to apply this manipulation. To recap the steps in the video:
- Open details for the action
Validate Contact
- Go to the section Update StreamItems section
Note |
---|
Because we have set Copy Values by Name, we only need to add a rule for values we want to manipulate. If Copy Values by Name was not ticked, we would need to set a rule for every value you want to save to the stream. |
- Open the list of stream attributes, and drag
PhoneNumber
into the list of stream item updates - Double click on the rule to open the details
Note | ||
---|---|---|
Note that the default expression for the rule is:
This is the value typed into the phone number field on the edit form, and therefore this simply copies the typed value into the stream. This expression can use any field from the edit form (provided by |
- Update the expression to replace a leading
0
with44
:
Code Block |
---|
replaceFirst(_form.PhoneNumber, "^0", "44") |
- Save your changes to the stream item update rule
Go into App Mode. Update a record - you will see the leading zero replaced by 44
. Because this action backs both the Add
and Update
buttons, this is also true for newly entered contacts.
Panel | ||||
---|---|---|---|---|
| ||||
Update the rule to set phone numbers to start To do this, you will need to edit the expression that sets the value, but also the validation expression - since currently this does not accept the |
Panel |
---|
Next chapter: 9. Screen flow |