2

I have a simple application on mvc3 with razor before i Open the dialog I tried to open an "alert" and it works correctly so function its working on the event but when i comment this alert and try to open the dialog it just does not work

@model MvcApplication1.Models.LogOnModel

@{
    ViewBag.Title = "Create";
}

<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>    
<script src="@Url.Content("~/Scripts/jquery-ui-1.8.11.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script>

<link href="@Url.Content("~/Content/themes/base/jquery.ui.all.css")" rel="stylesheet" type="text/css" />

<h2>Index</h2>

<script type="text/javascript">
    $(document).ready(function () {

        $('#dialog').dialog({
            autoOpen: false,
            width: 400,
            resizable: false,
            title: 'hi there',
            modal: true,

            buttons: {
                "Close": function () {
                    $(this).dialog("close");
                }
            }
        });

        $('#contactForm').submit(function (e) {
            //alert("entro a funcion");
            e.preventDefault();
            $('#dialog').dialog('open');
        });

    });
</script>



@using (Html.BeginForm("Index", "Infracciones", FormMethod.Post, new { id = "contactForm"}))
{
@Html.ValidationSummary(true)
    <fieldset>
        <legend>Infraccion</legend>

      </fieldset>
    <p>
    <input value="Guardar" type="submit" name = "button"/>
    </p>
}
5
  • 1
    where is your dialog open statement? where is your dialog body (div)? Commented Mar 24, 2013 at 1:50
  • Shows an error in chrome console?? Commented Mar 25, 2013 at 3:24
  • John paul no error in chorme console Commented Mar 25, 2013 at 3:26
  • Dave A. you r the man I forgot that f. div =) thank you Commented Mar 25, 2013 at 3:33
  • John paul thank you too =) Commented Mar 25, 2013 at 3:35

2 Answers 2

1

You only need to add this:

<div id="dialog">

In the body.

Sign up to request clarification or add additional context in comments.

1 Comment

yep and close div too if you want to =)
0

try:

$('#dialog').dialog();

instead of

$('#dialog').dialog('open');

1 Comment

As Dave asked, where is your dialog body?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.