SCRIPT5017: Syntax error in normal expression

Asked

Viewed 168 times

1

When I run my application through Chrome or Firefox it works perfectly. But by IE 10 at a certain point in the application gives this Javascript error.

**JavaScript critical error at line 99, column 86 in http://localhost:64146/VoucherRequest/ConfirmRequest?requestId=2862
SCRIPT5017: Erro de sintaxe em expressão normal**

// When I click on that button in IE, it gives the error message.

I searched and found nothing enlightening about. I already checked the syntax, I already put the following tag in the head

<meta http-equiv="X-UA-Compatible" content="IE=10" />

Anyway, it doesn’t work on my IE. I need a light!

EDIT

Voucherrequest/Confirmrequest

@model Request
@{
ViewBag.Title = "Requisição";
Layout = "~/Views/Shared/_Layout.cshtml";
}
<h1>
Requisição</h1>
<h2>
Passo 3:</h2>
<p>
Verifique os dados preenchidos e clique em concluir. Se alguma informação estiver
incorreta, clique em corrigir.</p>
<div class="form">
<div>
    <span class="title">Solicitante:</span><span class="field">@Html.DisplayFor(x => x.Usuario.Nome)</span>
</div>

    <span class="title">Observações:</span><span class="field">@Html.DisplayFor(x => x.Note)</span></div>

<table>
    <tr>
        <th>
            Funcionário
        </th>
        <th>
            Data
        </th>

        <th>
            Quantidade
        </th>
    </tr>
    @foreach (RequestItem item in Model.Items)
    {
        <tr>
            <td>
                @Html.DisplayFor(x => item.Usuario.Name)
            </td>
            <td>
                @Html.DisplayFor(x => item.Data)
            </td>

            <td>
                @Html.DisplayFor(x => item.Quantidade)
            </td>
        </tr>
    }
</table>
<div class="formfooter">
    <input type="button" value="Corrigir" onclick="[email protected]("EditRequest", new { requestId = Model.Id })" />
    <input type="button" value="Gerar pedido" onclick="window.open('@Url.Action("ProcessRequest", new { requestId = Model.Id })','_blank');window.location.href='@Url.Action("Index", "Home")'" /></div>

  • 2

    This @Url.Action... Take the generated source as it was rendered, please

1 answer

1


Apparently your links are being interpreted as a Regular Expression ("normal expression"? Seriously, Microsoft?). This is because the bars of the first link and the bars of the second complement each other. To illustrate, copy this snippet below on the Chrome console and hit enter to see how the string looks:

'<input type="button" value="Solicitar" onclick="window.open(\'http://localhost:64146/VoucherRequest/ConfirmRequest?requestId=2862\',\'_blank\');window.location.href=\'http://localhost:64146/\'" />'

To fix it, all I did was replace the single quotes that surrounded the url with double quotes, so the code of your .cshtml it has to be something like this:

<input type="button" value="Solicitar" onclick='window.open("@Url.Action("ProcessRequest", new { requestId = Model.Id })","_blank");window.location.href="@Url.Action("Index", "Home")"' /></div>

Browser other questions tagged

You are not signed in. Login or sign up in order to post.