Note that there are some explanatory texts on larger screens.

plurals
  1. POAjax form not submitted when there are HTML tags in the input field
    primarykey
    data
    text
    <p>I've started playing with Ajax and found a (hopefully) little problem I can't seem to find an answer to.</p> <p>I generate a list of Ajax forms on my page, the code looks like this</p> <pre><code>using (Ajax.BeginForm("FixTranslation", new { translationId = errorGroup.Key.Id }, new AjaxOptions { UpdateTargetId = "targetCell_" + errorList.Key.Id })) { &lt;table&gt; &lt;tbody&gt; &lt;tr&gt;&lt;td&gt;@errorGroup.SourceText&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td id="@("targetCell_" + errorGroup.Id)"&gt;&lt;input type="text" name="text" id="@("target_" + errorGroup.Id)" value="@(errorGroup.TargetText.Replace(' ', (char)0x00A0))" /&gt;&lt;input type="submit" value="Fix" /&gt;&lt;/td&gt;&lt;/tr&gt; @foreach (var error in errorGroup.Value) { &lt;tr&gt;&lt;td&gt;@error.Description&lt;/td&gt;&lt;/tr&gt; } &lt;/tbody&gt; &lt;/table&gt; } </code></pre> <p>In the controller I have this action:</p> <pre><code>public ActionResult FixTranslation(string projectId, int translationId, string text) { if (Request.IsAjaxRequest()) { return Content("You entered: " + new HtmlString(text)); } return RedirectToAction("GetProjectOverview", new { projectId = projectId }); } </code></pre> <p>This works fine when there are no angle brackets present in the input field, the form gets sent properly. But when there are some angle brackets (e.g. "This is text with &lt;1>tags") in the input field, my action method does not get called at all.</p> <p>Does anybody know why this is happening?</p> <p>Thank you very much.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload