SwiftyFORM icon indicating copy to clipboard operation
SwiftyFORM copied to clipboard

Explanation of validateAndUpdateUI() vs validate()

Open justdan0227 opened this issue 2 years ago • 3 comments

Can you provide an explanation of the two in the documentation? Thanks!

justdan0227 avatar Sep 30 '21 23:09 justdan0227

Invoking form_installSubmitButton() and a "Submit" button gets shown in the navigation bar. It shows an alert with validation status. The form_installSubmitButton() can used during development for validating the form.

When the form actually have to be submitted to a server or similar, then one will have to make a custom function for uploading to the server.

neoneye avatar Oct 01 '21 06:10 neoneye

Oh I'm so sorry.. I didn't explain my question. I have a submit button that when pressed I call

formBuilder.validateAndUpdateUI()

let result = formBuilder.validate()

I check the result from formBuilder.validate(), but I"m not sure what formBuilder.validateAndUpdateUI() does (but saw it in your example code). I don't see those calls documented.

justdan0227 avatar Oct 01 '21 14:10 justdan0227

It seems to end up calling TextFieldCell.reloadPersistentValidationState. This function invalidates a timer and hides an eventual error message shown below the textfield.

Sorrry, I can't remember what I intended with validateAndUpdateUI.

neoneye avatar Oct 02 '21 08:10 neoneye