PDA

View Full Version : [FIXED] [V0.5] TextField Bug



egof
Jun 12, 2008, 12:54 AM
Hi I have a problem a dont know if is a bug!
The problem is this :
My TextField is FILL and when a try (in runtime) to put a value "" (empty) in the TextField, dont work, is simple like this, dont empty the TextField!

THIS IS A BUG?

Thank you for all!!!!

geoffrey.mcgill
Jun 12, 2008, 2:07 AM
Can you please post the <ext:TextField> tag you use and/or the code-behind used to create the control?

geoffrey.mcgill
Jun 12, 2008, 7:51 AM
Hi egof,

I tried a few tests with the TextField and everything appears to be working correctly. When you get a chance, please post a code sample demonstrating how to reproduce the problem.

The following sample demonstrates the basic use of the TextField.

Example


<%@ Page Language="C#" %>

<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.TextField1.Text))
{
this.Label1.Text = "{Empty}";
}
else
{
this.Label1.Text = this.TextField1.Text;
}
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>TextField Test</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />

<ext:TextField ID="TextField1" runat="server" />
<ext:Button ID="Button1" runat="server" &#111;nclick="Button1_Click" Text="Submit" />
<asp:Label ID="Label1" runat="server" />
</form>
</body>
</html>


Hope this helps.

egof
Jun 12, 2008, 9:52 AM
<%@ Page Language="C#" %>

<%@ Register assembly="Coolite.Ext.Web" namespace="Coolite.Ext.Web" tagprefix="ext" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.TextField1.Text))
{
this.TextField1.Text = "hello world!!!";
}
else
{
this.TextField1.Text=""; //THIS IS THE POINT, HOW CAN I SET TO EMPTY("") THE TextField?
} // LIKE I DID DONT CHANGE ANYTHING!!!!
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>TextField Test</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server" />

<ext:TextField ID="TextField1" runat="server" />
<ext:Button ID="Button1" runat="server" &#111;nclick="Button1_Click" Text="Submit" />
</form>
</body>
</html>

geoffrey.mcgill
Jun 12, 2008, 10:37 PM
Fixed. It was a bug, and a very interesting one.

If you're building from source, add the following attribute to the Value property of TextField.cs (approx line 69).

Example


[DefaultValue(null)]

If the Text was empty ("") the ClientConfig script was ignoring property and not rendering the proper JavaScript to the browser. Now, the Text/Value will always render.

The source has been updated and this fix will be available with the next public release (v0.5.2).

Thanks again for pointing out the bug.

jumbot
Jun 14, 2008, 3:40 PM
that's well!
My English is very poor!
Can I say In Chinese When i ask question Next Time?

geoffrey.mcgill
Jun 15, 2008, 6:02 AM
Hi jumbot,

Welcome to the forums! Huan yin!

I think you have great english skills. Much better than my Chinese. ;)

Feel free to post in the language of your choice, although I would suggest also translating as best you can into English.

egof
Jun 19, 2008, 1:42 PM
The same bug that happend with TextField that i reported some days ago,now is happen with TextArea.

geoffrey.mcgill
Jun 19, 2008, 10:02 PM
Hi egof,

Good point. I should have caught the TextArea problem when fixing TextField. Sorry about that.

The bug has been fixed with TextArea.

I also did some work with <ext:NumberField> and added a new .Number property. The .Number property accepts a Double object. To clear the NumberField you can set the .Number property to Double.MinValue or use the new .Clear() Method.

Hope this helps.

The code above will be available with v0.6.0.