Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

Seemingly not possible to validate field-by-field on navigation page

$
0
0

I have some text fields (Entry) on a navigation page and need to validate them as they are entered, rather than validating them all at once at the end. Amazingly there does not seem to be a way to do this.

I tried using the Defocused event on each Entry, generating an error message when the data is invalid. However this does not work cleanly because if the user has left an invalid value in a field and presses the back button at top left before visiting another Entry, we pop back to the previous page but then an unwanted validation error message belatedly appears. (Apart from this, it works.)

Have not been able to solve this, given that apparently there is no way to intercept the back button press, on iOS at least.

I tried using the OnDisappearing event to clear the offending field, but this happens too late to be useful, even when done before calling base.OnDisappearing ().

Another idea that did not work was to examine, in the Defocused event handler, the title of the page currently on top of the navigation stack to see if it corresponded to the page that was popped to (it didn't).

It seems like what's really badly needed, here and elsewhere, is a way to intercept a back button press.

Any suggestions very welcome.


Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>