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 9258441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:24:16+00:00 2026-06-18T12:24:16+00:00

I am working on as asp.net MVC 2 application. I have a form like

  • 0

I am working on as asp.net MVC 2 application. I have a form like this:

<% using (Html.BeginForm("SaveCallRecording", "Recording", FormMethod.Post, new { id = "frmAddCallRecording", name = "frmAddCallRecording" }))
                           {%>

        <tr>
                                    <td>
                                    </td>
                                    <td>
                                        <input type="button" id="btnCall" title="Call" value="Call" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
                                        <input type="button" id="btnNewCall" title="New Call" value="New Call" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
                                    </td>
                                </tr>
                            </table>
                            <%} %>

I have this in document.ready

 $("#btnCall").click(function () {
                var CallStatus = $("#txtCallStatus").val();
                if (CallStatus == 'READY') {
                    if ($("#isUniquePassword").is(':checked') && $("#UniquePassword").val() == '') {
                        $("#dialog-RecipientEmail-error").dialog("open");
                    }
                    else {
                        $.ajax({
                            type: "POST",
                            dataType: "json",
                            url: "/account/getGenericPassword",
                            success: function (data) {
                                if (data == null || data == "") {
                                    if ($('#isGenericPassword').is(':checked')) {
                                        $("#dialog-add-generic-password").dialog("open");
                                    }
                                }
                                else {
                                         $("#frmAddCallRecording").submit();
                               //after this I want to show alert based on result                                   
                                }
                            }
                        });
                    } // end of isUniquePassword if
                } // end of call status if
                else if (CallStatus == 'NOT SET') {
                    $("#dialog-required-fields").dialog("open");
                }
            });

and controller is like this:

  [Authorize]
        [HttpPost]
        public JsonResult SaveCallRecording(CallRecording recording, FormCollection form)
        {
     return Json("record saved!");
            }

After actionresult SaveCallRecording is executed, I want to show success or fail message. How can I do it ? If I try $.ajax, I need to form form data manually using `data: { “item” : “value1” , ….}. I tried using $.post but I need to pass data to it manually as well. If I make btnCall as submit button instead of button, then validation fails.

I want to:

1) Validate form first and show alerts if form is not validated.
2) post form data to json Action method SaveCallRecording
3) Get success or fail message from Action Method and show as alert

Please suggest solution to it.

  • 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-18T12:24:17+00:00Added an answer on June 18, 2026 at 12:24 pm

    You could start by placing this form inside a partial (_SaveCallRecordingForm.ascx):

    <% using (Html.BeginForm("SaveCallRecording", "Recording", FormMethod.Post, new { id = "frmAddCallRecording", name = "frmAddCallRecording" })) { %>
        <tr>
            <td></td>
            <td>
                <input type="button" id="btnCall" title="Call" value="Call" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
                <input type="button" id="btnNewCall" title="New Call" value="New Call" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" />
            </td>
        </tr>
    <% } %>
    

    Also if you expect to be able to do some validations I would recommend you to make this partial strongly typed to your CallRecording model and use Html helpers to generate the input fields in this form. You could also use the validationMessageFor helper to generate placeholders for the errors.

    And then you could AJAXify this form:

    else {
        var $form = $("#frmAddCallRecording");
        $.ajax({
            url: $form.attr('action'), 
            type: $form.attr('method'),
            data: $form.serialize(),
            success: function(result) {
                if (result.success) {
                    alert('Thanks for submitting');
                } else {
                    $('#someContainerOfYourForm').html(result);
                }
            }
        });
    }
    

    and have your controller action perform the validation and return either a JsonResult (in case of success) or a PartialView with the list of errors:

    [Authorize]
    [HttpPost]
    public ActionResult SaveCallRecording(CallRecording recording)
    {
        if (!ModelState.IsValid)
        {
            // There were validation errors => let's redisplay the form
            return PartialView("_SaveCallRecordingForm", recording);
        }
    
        // at this stage we know that the model is valid => do some processing
        // and return a JsonResult to indicate the success
        return Json(new { success = true });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working with an ASP.NET MVC application. I have one master page having
I am working on an asp.net MVC 3 application. I have a C# function
I am working on a Facebook tab application. I am using asp.net MVC 2
I have an ASP.NET MVC 2 form that is working perfectly, doing client side
I'm working on a ASP.NET MVC (an older version) application and I have a
I have an asp.net mvc 3 application. In this application I have a reminder
I am working in an ASP.NET MVC Application. I have a view model as
I have a working ASP.NET MVC 3 application. The project is built with VS
I am working on a ASP.NET MVC application where we have to write our
I am working on a asp.net mvc application. I have a situation where I

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.