PDA

View Full Version : [CLOSED] Form should work with url which has quotation marks



macroe
May 27, 2014, 1:15 PM
Hi!
Here's a problem: it will throw exception when the form's url which has quotation marks. Here is the code:



Html.X().FormPanel().Url("http://x.com/index?a=[\"a,b,c\"]")


Here is generated code:


Ext.onReady(function(){Ext.create("Ext.form.Panel",{renderTo:"App.idcfe3181db12308cb_Container",url:"http://x.com/index?a=["a,b,c"]"});});

geoffrey.mcgill
May 27, 2014, 6:07 PM
Maybe try double escaping the Quotation marks. Use two back-slash instead of one. If two doesn't work, try three, then four. One of those combinations should work.

Daniil
May 27, 2014, 6:10 PM
Three backslashes appear to be working.

"http://x.com/index?a=[\\\"a,b,c\\\"]"

I think you can also use a single quote.

"http://x.com/index?a=['a,b,c']"

macroe
May 28, 2014, 5:56 AM
Three backslashes appear to be working.

"http://x.com/index?a=[\\\"a,b,c\\\"]"

I think you can also use a single quote.

"http://x.com/index?a=['a,b,c']"

Yeah, but if I submit the form with get method and take some parameter like this: {a:["2","3"]}, ( {a:["2","3"]} is come form checked treenode ) it still error. Can you add some code to auto encode the parameter?

Daniil
May 28, 2014, 6:15 AM
Please provide a test case to reproduce. I test with this sample. It appears to be working well.

Example

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

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.FormPanel1.Url = "http://localhost:51980/Work2.aspx?a=[\\\"a,b,c\\\"]";
}

if (this.Request["a"] != null)
{
this.Response.Clear();
this.Response.Write(this.Request["a"]);
this.Response.End();
}
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:FormPanel ID="FormPanel1" runat="server" Title="FormPanel" />

<ext:Button runat="server" Text="Submit" Handler="App.FormPanel1.submit();" />
</form>
</body>
</html>