PDA

View Full Version : [CLOSED] Type="Submit" not working anymore



reinout.mechant@imprss.be
Jun 17, 2013, 9:54 AM
Hi,

In my login form, the button to login has the setting: Type="Submit".
This worked before, but since 2. it doesn't work anymore.

Any idea?

Kind regards,

Reno

Daniil
Jun 17, 2013, 2:13 PM
Hi @Reno,

It has been removed. I discovered that it is missed in the BREAKING_CHANGES.txt and added the following item.

176. The Button's Type property has been removed.

If you need an equivalent of Type="Submit", please set up a Button's AutoPostBask="true". It will do a PostBack on Button click.

There is no a direct equivalent of Type="Reset", but you can use a FormPanel and its reset functionality:

App.FormPanel1.getForm().reset();

reinout.mechant@imprss.be
Jun 17, 2013, 3:20 PM
Hi Daniil,

It is a login form, with a username and a password.
Most of the times the user hits enter after typing the password in.

How should I implement this? Will this be caught by the Autopostback?
But the problem is that my button is linked to a DirectMethod...

Kind regards,

Reno

Daniil
Jun 17, 2013, 5:35 PM
Please set up DefaultButton="SubmitButtonID" for the FormPanel. When Enter press should be interpreted as click on the Button. And if AutoPostBack="true", a PostBack should occur.

reinout.mechant@imprss.be
Jun 18, 2013, 8:56 AM
Hello Daniil,

That doesn't work, due to the AutoPostBack, the login is now broken. It return always back to the login screen.

Here is my code:



<ext:Window
ID="ui_windowLogin"
runat="server"
Closable="false"
Resizable="false"
Height="150"
Icon="Lock"
Title="Login"
Draggable="false"
Width="350"
Modal="true"
BodyStyle="padding:5px;"
Layout="Fit">
<Items>
<ext:FormPanel runat="server" ID="ui_formpanelLogin" Layout="FormLayout" Border="false" BodyStyle="background-color:transparent;" DefaultButton="ui_buttonLogin">
<Items>
<ext:TextField
ID="ui_textfieldUserName"
runat="server"
ReadOnly="false"
FieldLabel="Username"
AllowBlank="false"
MsgTarget="Side"
Text=""
AnchorHorizontal="90%" />
<ext:TextField
ID="ui_textfieldPassword"
runat="server"
ReadOnly="false"
InputType="Password"
FieldLabel="Password"
AllowBlank="false"
MsgTarget="Side"
Text=""
AnchorHorizontal="90%" />
</Items>
<Listeners>
<ValidityChange Handler="#{ui_buttonLogin}.setDisabled(!#{ui_formpanelLogin }.getForm().isValid());" />
</Listeners>
</ext:FormPanel>
</Items>
<Buttons>
<ext:Button ID="ui_buttonLogin" runat="server" Text="Login" Icon="Accept" AutoPostBack="true">
<DirectEvents>
<Click OnEvent="ui_buttonLogin_Click" Success="#{ui_windowLogin}.close();">
<EventMask ShowMask="true" Msg="Verifying..." MinDelay="1000" />
</Click>
</DirectEvents>
</ext:Button>
</Buttons>
<Listeners>
<Show Handler="#{ui_textfieldUserName}.focus();" Delay="40" />
</Listeners>
</ext:Window>





protected void ui_buttonLogin_Click(object sender, DirectEventArgs e)
{
SETTINGS_Users loggedOnUser = Common.Security.Authenticate(ui_textfieldUserName. Text, ui_textfieldPassword.Text);
if (loggedOnUser != null)
{
Session["LOGGEDON"] = true;
Session["USEROBJECT"] = loggedOnUser;
FormsAuthentication.SetAuthCookie(loggedOnUser.Use rName, false);
Response.Redirect(FormsAuthentication.DefaultUrl);
}
else
{
Response.Redirect(FormsAuthentication.LoginUrl); // The default is "login.aspx."
}
}




Thanks,

Reno

Daniil
Jun 18, 2013, 9:01 AM
Well, if you use a DirectEvent, you should not use AutoPostBack="true".

reinout.mechant@imprss.be
Jun 18, 2013, 9:02 AM
THANKS!!! Works like a charm!

michaeld
Jun 18, 2013, 11:15 PM
.....................sorry, edited. I posted on wrong thread.