View Full Version : [CLOSED] Form and field validation

Feb 02, 2017, 4:12 AM
Do you have any examples of how validation can be done in Mobile? I cannot find properties like AllowBlank and such. Is there a simple way?

Feb 03, 2017, 12:24 AM
Hello @sveins12!

Fact is that no, there is no validation like we have with Ext.NET. At least for now, it has to be handled by the developer, with change events client or server-side, and applying CSS for visual feedback.

Here's a suggestion or starting point you could use for the validation part's visual feedback. As for functional feedback, you can just bind an valid=true field to the item object during the event (that will go straight to the App.DateField1.valid) that you could check before submitting, for example. Or just disable the submit/save button when any field is set to invalid.

@using Ext.Net.Mobile;
@using Ext.Net.Mobile.MVC;
Layout = null;
var x = Html.X();
<!DOCTYPE html>
<title>Test DatePickerField</title>
<style type="text/css">
.invalid {
color: #ffaaaa;
font-weight: bold
.DateValue(new DateTime(2016, 6, 24))
.Listeners(l => l.Change.Handler = MvcUtils.StringifyScriptBlock(@<text>
<script type="text/javascript">
var fullYear = newDate.getFullYear(),
fieldSet = item.up('fieldset');

if (fullYear <= 2016) {
var message = "Year must be greater than 2016!";
if (fieldSet) {
title: message,
baseCls: "x-form-fieldset-instructions invalid"
} else {
X.Msg.alert('Field validation error', message);

} else {

if (fieldSet) {

Hope this helps!

Feb 25, 2017, 3:56 AM
Hello @sveins12!

Been some time since we replied you here, still no feedback. Did the reply meet your expectations, was it helpful? Do you still need help on this issue? Please notice we may mark this thread as closed if you still don't post a follow-up in 7+ days from now, but that won't prevent you from posting here when you have time.