Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8206507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:41:53+00:00 2026-06-07T08:41:53+00:00

I’m trying to have some Ajax form in the page which is not working

  • 0

I’m trying to have some Ajax form in the page which is not working at all, it does not send any requests on submit, noting in firebug, the form is being loaded to page by ajax, but I have other forms which are loaded to form by ajax into a jquery UI dialog and they are working fine, here is my whole partial view code , (the Part with action “SeacrhTasksTable” not working) I’d attach the rendered the whole HTML but it’s so big.

@model APS.HelpDesk.UI.MyModel<APS.HelpDesk.Data.App_ProjectTask>
<h2>
    پروژه
    @ViewBag.ProjectTitle
</h2>
<div class="wrapperTask">
    <div class="firstTask">
   @* <input type="hidden" value="@(ViewBag.ProjectId)" />*@
        @Ajax.ActionLink("تعریف کار جدید", "AddProjectTaskDialog", new
   {
       Id = ViewBag.ProjectId,
       area = "ProjectAdmin"
   }, new AjaxOptions()
   {
       HttpMethod = "GET",
       LoadingElementId = "AddProjectTaskLoadingGif",
       UpdateTargetId = "AddProjectTaskDialog",
       InsertionMode = InsertionMode.Replace,
       OnBegin = "clearDialogs();",
       OnSuccess = " $('#AddProjectTaskDialog').dialog('open');"
   }, new { id = "AddProjecTaskLink" })
        <a href="javascript:void(0);" id="resetbutton">بارگذاری مجدد جدول </a>
    </div>
    <div class="secondTask">
        <div id="AddProjectTaskLoadingGif" style="display: none;">
            <img src="@Url.Content("~/Content/Images/ajax-loader/253L.gif")" alt="" />
        </div>
    </div>
</div>
<div id="test">
    <table>
        <tr>
            <th>
                #
            </th>
            <th>
                کد کار
            </th>
            <th>
                عنوان کار
            </th>
            <th style="min-width: 300px;">
                مختصری از توضيحات
            </th>
            <th>
                تاريخ ايجاد کار
            </th>
            <th>
                مهلت انجام
            </th>
            <th>
                وضعيت
            </th>
            <th>
                وابستگی های کار
            </th>
            <th colspan="2">
                ويرايش و حذف
            </th>
        </tr>
         @using (Ajax.BeginForm("SeacrhTasksTable", new { area = "ProjectAdmin" }, new AjaxOptions
    {
        HttpMethod = "POST",
        InsertionMode = InsertionMode.Replace,
        UpdateTargetId = "test" 
    }))
        {
            <tr>
                <td>
                </td>
                <td>
                    <input type="text" id="IdTask"  style = "width:40px"  name = "Id" />
                </td>
                <td>
                    <input type="text" id="TitleTask"  style = "width:80%;" placeholder = "جست و جو" name = "Title" />
                </td>
                <td style="min-width: 250px;">
                    <input type="text" id="DescriptionTask"  style = "width:80%;" placeholder = "جست و جو" name = "Description" />
                </td>

                 <td>
                     <input type="text" id="DeliverDateTask"  style = "width:80%;" placeholder = "جست و جو" name = "DeliverDate" />
                 </td>
                 <td>
                     <input type="text" id="DeadlineDateTask"  style = "width:80%;" placeholder = "جست و جو" name = "DeadlineDate" />
                 </td>
                 <td>
                   <select name="Status">
                       <option value="0"> همه</option>
                       <option value="1">شروع نشده</option>
                       <option value="2">در حال انجام</option>
                       <option value="3">تمام شده</option>
                       <option value="4">بی مسئول</option>
                    </select>
                </td>
                <td colspan="4">

                    <input type="submit" value="submit" style="" />
                    <input type="hidden" value="@(ViewBag.ProjectId)" name="ProjectId" id ="ProjectIdTask"/>

                </td>
            </tr>
        }
        <tbody id="TaskList">
            @Html.Partial("_ProjectTaskList", Model.MyList)
        </tbody>
        <tfoot>
            <tr>
                <td colspan="3">
                    صفحه
                    @(Model.PageIndex + 1)
                    از
                    @Model.TotalPages
                    [ تعداد کل : @Model.TotalCount ]
                </td>
                <td id="pagesizeTaskTd" style="text-align: center;">
                    سايز صفحه
                    <select id="pagesizeTask">
                        <option value="5">5</option>
                        <option value="10" selected="selected">10</option>
                        <option value="25">25</option>
                        <option value="50">50</option>
                    </select>
                </td>
                <td colspan="6" align="left" class="tfoot-padding" id="morepagesTask">
                    @{
                        int start = Model.PageIndex;
                        if (start > 0)
                        {
                            int c = 0;
                            while (start > 0 && c < 4)
                            {
                                c++;
                                start--;
                            }
                        }
                        for (int j = start; j < Model.TotalPages && j < start + 10; j++)
                        {
                            if (Model.PageIndex != j)
                            {


                        <span>
                            @Ajax.ActionLink((j + 1).ToString(), "TaskListTablePage", "Project", new
                       {
                           Id = ViewBag.ProjectId,
                           PageIndex = j,
                           PageSize = Model.PageSize,
                           area = "ProjectAdmin"
                       }, new AjaxOptions
                       {
                           HttpMethod = "GET",
                           UpdateTargetId = "test",
                           InsertionMode = InsertionMode.Replace
                       }, new { mode = "mode" })
                        </span>
                            }
                            else
                            { 
                        <span><b style="text-decoration: underline;">@(j + 1)</b></span>
                        <input type="hidden" id="PIndexAll" value="@(j)" />
                            }
                        }
                        if (Model.PageIndex + 10 < Model.TotalPages)
                        { 
                        <span>. . . </span>
                        }
                    }
                </td>
            </tr>
        </tfoot>
    </table>
</div>
<div id="AddProjectTaskDialog" title="تعریف کار جدید" style="text-align: right;">
</div>
<div id="EditProjectTaskDialog" title="ويرايش کار" style="text-align: right;">
</div>
<div id="ReportProjectTaskDialog" title="گزارش کل کار" style="text-align: right;">
</div>
<div id="DescriptionProjectTaskDialog" title="توضيح کار" style="text-align: right;">
</div>
<div id="EditProjectDepenDialog" style="text-align: right;">
</div>
<div id="Taskresult">
</div>
<script type="text/javascript">

    $("#AddProjectTaskDialog").dialog({
        autoOpen: false,
        width: 720,
        modal: true,
        draggable: true,
        position: "top"
    });

    $("#EditProjectTaskDialog").dialog({
        autoOpen: false,
        width: 720,
        modal: true,
        draggable: true,
        position: "top"
    });

    $("#EditProjectDepenDialog").dialog({
        autoOpen: false,
        width: 720,
        modal: true,
        draggable: true,
        position: "top",
        buttons: {
            "OK": function () {
                $(this).dialog("close");
            }
        }
    });


    $("#AddProjecTaskLink").button();
    $("#resetbutton").button();


    $("#pagesizeTask").live( 'change' ,  function (){

        var val = $(this).find(":selected").val();
        $("#morepagesTask").find('*[mode]').each(function(index){

            var n=$(this).attr("href").lastIndexOf("=");
            var t= $(this).attr("href").substring(0,n+1);
            $(this).attr("href" ,t+val );
        });

          var url = '@Url.Action("TaskListTablePage", new { area = "ProjectAdmin" })';
          url += '?Id=' + @(ViewBag.ProjectId);         
          url += '&PageIndex=' + $("#PIndexAll").val();
          url += '&PageSize=' +val;         
          $.ajax({
              url: url, type: 'get',
              success: function (data, status) {
                $("#test").html('');
                $("#test").html(data);
              }
          });         

    });

     $(".firstTask").delegate( '#resetbutton','click',function(){

        var url = '@Url.Action("TaskListTablePage", new { area = "ProjectAdmin" })';
          url += '?Id=' + @(ViewBag.ProjectId);         
          url += '&PageIndex=0' ;
          url += '&PageSize=10';          

          $.ajax({
              url: url, type: 'get',
              success: function (data, status) {
                $("#test").html('');
                $("#test" ).html(data);
              }
          }); 

        });
</script>

HTML of Form

<form action="/ProjectAdmin/Project/SeacrhTasksTable" data-ajax="true" data-ajax-method="POST" data-ajax-mode="replace" data-ajax-update="#test" id="form0" method="post">            <tr>
                <td>
                </td>
                <td>
                    <input type="text" id="IdTask"  style = "width:40px"  name = "Id" />
                </td>
                <td>
                    <input type="text" id="TitleTask"  style = "width:80%;" placeholder = "جست و جو" name = "Title" />
                </td>
                <td style="min-width: 250px;">
                    <input type="text" id="DescriptionTask"  style = "width:80%;" placeholder = "جست و جو" name = "Description" />
                </td>

                 <td>
                     <input type="text" id="DeliverDateTask"  style = "width:80%;" placeholder = "جست و جو" name = "DeliverDate" />
                 </td>
                 <td>
                     <input type="text" id="DeadlineDateTask"  style = "width:80%;" placeholder = "جست و جو" name = "DeadlineDate" />
                 </td>
                 <td>
                   <select name="Status">
                       <option value="0"> همه</option>
                       <option value="1">شروع نشده</option>
                       <option value="2">در حال انجام</option>
                       <option value="3">تمام شده</option>
                       <option value="4">بی مسئول</option>
                    </select>
                </td>
                <td colspan="4">

                    <input type="submit" value="submit" style="" />
                    <input type="hidden" value="38" name="ProjectId" id ="ProjectIdTask"/>

                </td>
            </tr>
</form> 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T08:41:55+00:00Added an answer on June 7, 2026 at 8:41 am

    Your code doesn’t work because you have invalid markup. By invalid markup I mean that you have a <form> nested directly inside a <tr> which is forbidden by the specification. You cannot have a <form> inside a <table>, <tbody> or <tr>.

    To illustrate the problem in a simplified manner, here’s what you have currently which is invalid:

    <table>
        <tr>
            <form>
                <td>Foo</td>
                <td>Bar</td>
                <td><input type="submit" /></td>
            </form>
        </tr>
    </table>
    

    Just inspect the DOM with FireBug and you will see how your <form> is floating alone (opening and closing immediately) without any elements inside.

    This is invalid markup and it results in undefined behavior which in your case translates by the browser simply not submitting the form. The reason this happens is because the unobtrusive-ajax library that you are using subscribes to the submit event to all ajax forms using a .live:

    $("form[data-ajax=true]").live("submit", function (evt) {
        ...
    });
    

    The thing is that the submit event is never raised in this case. A similar question has been asked yesterday with the same problem.

    To fix this problem you could use nested tables:

    <table>
        <tr>
            <td>
                <form>
                    <table>
                        <tr>
                            <td>Foo</td>
                            <td>Bar</td>
                            <td><input type="submit" /></td>
                        </tr>
                    </table>
                </form>
            </td>
        </tr>
    </table>
    

    So simply put your Ajax.BeginForm inside a <td> and then use a nested table to put the elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text area in my form which accepts all possible characters from
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have just tried to save a simple *.rtf file with some websites and
I have an autohotkey script which looks up a word in a bilingual dictionary
I'm trying to select an H1 element which is the second-child in its group
I have an array which has BIG numbers and small numbers in it. I
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.