Sep 17, 2014, 3:09 PM
[CLOSED] FormPanel loaded with invalid fields
Hi Guys,
as usual I have a dumb question; I have a window with a formpanel with some validation logic. When the form is submitted if there are errors then I show the message target near the control. And it works very well.
Edit button pressed on the record -> if one or more properties are invalid then the related control in the window is marked as invalid with message at the right side.
Do you have any suggestion?
Best regards
as usual I have a dumb question; I have a window with a formpanel with some validation logic. When the form is submitted if there are errors then I show the message target near the control. And it works very well.
@(
X.Window()
.ID("WizardAddUserWindow1")
.Height(510)
.Icon(Icon.UserAdd)
.Width(windowWidth)
.Title("Nuovo utente (Passo 1 di 4)")
.Resizable(false)
.Closable(true)
.Border(true)
.Layout(LayoutType.Fit)
.CloseAction(CloseAction.Destroy)
.Modal(true)
.Items(
X.FormPanel()
.ID("WizardFormPanel1")
.Url(Url.Action("WizardUserAddStep1", "Admin"))
.Border(false)
.Header(false)
.BodyPadding(10)
.FieldDefaults(def =>
{
def.MsgTarget = MessageTarget.Side;
})
.Items(
field =>
{
field.Add(
Html.X()
.Panel()
.ID("PanelHeader1")
.Html("<h1 class='margin-top-0'>Creazione guidata nuovo utente:</h1><p>Passo 1 di 4: dati anagrafici</p>")
.Header(false)
.Border(false)
);
field.Add(
Html.X()
.Panel()
.ID("PanelHeader1Line")
.Html("<hr />")
.Header(false)
.Border(false)
.StyleSpec("padding: 0px; margin-bottom: 10px;")
);
field.Add(
Html.X().TextFieldFor(m => m.userAddDto.Firstname)
.FieldLabel("Nome")
.Width(componentWidth)
.LabelWidth(labelWidth)
.AllowBlank(false));
field.Add(
Html.X().TextFieldFor(m => m.userAddDto.Lastname)
.FieldLabel("Cognome")
.Width(componentWidth)
.LabelWidth(labelWidth)
.AllowBlank(false));
field.Add(
Html.X().TextFieldFor(m => m.userAddDto.Username)
.FieldLabel("Nome utente")
.Width(componentWidth)
.LabelWidth(labelWidth)
.AllowBlank(false));
field.Add(
Html.X().TextFieldFor(m => m.userAddDto.PhoneNumber)
.FieldLabel("Telefono")
.Width(componentWidth)
.LabelWidth(labelWidth));
field.Add(
Html.X().TextFieldFor(m => m.userAddDto.CelNumber)
.FieldLabel("Cellulare")
.Width(componentWidth)
.LabelWidth(labelWidth));
field.Add(
Html.X().TextFieldFor(m => m.userAddDto.Email)
.FieldLabel("Email")
.Width(componentWidth)
.LabelWidth(labelWidth)
.AllowBlank(false)
.Vtype("email")
.VtypeText("Il valore inserito deve essere un indirizzo email nel formato \"utente@dominio.com\""));
field.Add(
Html.X().DateFieldFor(m => m.userAddDto.dtValidFrom)
.FieldLabel("Valido dal")
.AllowBlank(true)
.Width(componentWidth)
.LabelWidth(labelWidth)
.Format(format)
);
field.Add(
Html.X().DateFieldFor(m => m.userAddDto.dtValidTo)
.FieldLabel("Valido al")
.AllowBlank(true)
.Width(componentWidth)
.LabelWidth(labelWidth)
.Format(format)
);
field.Add(
Html.X().ComboBoxFor(m => m.userAddDto.strExpireTypeId)
.ID("cbxFirm")
.FieldLabel("Scadenza password")
.Editable(false)
.AllowBlank(false)
.Width(componentWidth)
.LabelWidth(labelWidth)
.Items(
from p in Model.userAddDto.listExpireType
select
new Ext.Net.ListItem
{
Text = p.Description,
Value = p.Val.ToString()
})
);
field.Add(
Html.X()
.Panel()
.ID("PanelBody1Line")
.Html("<hr />")
.Header(false)
.Border(false)
);
field.Add(
Html.X().CheckboxFor(m => m.userAddDto.bIsAdmin).BoxLabel("Utente con privilegi di amministratore").HideLabel(true)
.Width(componentWidth)
.LabelWidth(0)
);
field.Add(
Html.X().CheckboxFor(m => m.userAddDto.bIsDisabled).BoxLabel("Utente disabilitato").HideLabel(true)
.Width(componentWidth)
.LabelWidth(0)
);
}
)
.Buttons(
X.Button()
.ID("btnNext")
.Text("Prossimo")
.Icon(Icon.NextGreen)
.Handler("Hsi.accountModule().WizardAddUserStep1();")
)
)
)
After submission the record is saved; I would like to implement a check in the edit window like below:Edit button pressed on the record -> if one or more properties are invalid then the related control in the window is marked as invalid with message at the right side.
Do you have any suggestion?
Best regards
Last edited by Daniil; Sep 26, 2014 at 12:18 PM.
Reason: [CLOSED]