logo
down
shadow

Remove default submit on modal form button


Remove default submit on modal form button

Content Index :

Remove default submit on modal form button
Tag : javascript , By : demize95
Date : November 23 2020, 09:01 AM

I wish did fix the issue. The , when inside a form element, will submit the form when clicked unless you return false or event.preventDefault();
Omitting preventDefault() will always submit the form because your input is a "SUBMIT". e.preventDefault() it's just like returning false, nothing is really invoked in the server.
    [HttpPost]
public JsonResult UpdateClientDetails(Client newClientDetails)
{
    _clientService.UpdateClient(newClientDetails);
    return Json("Success", JsonRequestBehavior.DenyGet);
}
$(".btn-primary").click(function () {
    $.ajax({
                url: 'URL to your json method',
                type: 'POST',
                dataType: 'json',
                data: 'Build your JSON object and set it here',
                cache: false,
                contentType: 'application/json; charset=utf-8',
                success: function (data) {

                    var returnValue;
                    try {
                        returnValue = data;

                        //Do your logic. 
                        $("#dialog-actions").dialog('close');

                    } catch (e) {
                        // error

                        return;
                    }


                },
                error: function () { alert("Something went wrong! Please contact the system admin.") }
            })
});

Comments
No Comments Right Now !

Boards Message :
You Must Login Or Sign Up to Add Your Comments .

Share : facebook icon twitter icon

Show a Modal Window on Form Submit and Submit form While Modal "Accept" Button is clicked?


Tag : jquery , By : user183289
Date : March 29 2020, 07:55 AM
it helps some times Does this help? basically you need a "flag" to say the agreement was made, and then submit the form. I've shown a data-attribute being used as it's neat and simple. I've not tested this code but it's logically sound.
$('#f').on('submit', function(e) {
  if( $(this).data('form-agree') !== true ) {
    e.preventDefault();
    // fire modal logic here.
  }
});

$('#agreesubmit').on('click', function() {
  $('#f').data('form-agree', true).submit();
});

Fire a remote bootstrap modal when clicking a form submit button, remote modal content then has form data to be displaye


Tag : html , By : Boyer C.
Date : March 29 2020, 07:55 AM
Any of those help Was able to make it work but not remotely
Bootstrap 3 buttons are submit type by default, so I used a standard one that fired a modal...
button#submit.btn.btn-primary(name='submit' data-toggle="modal" data-target="#myModal") Submit
.modal.fade(id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true")
  .modal-dialog.wide-modal
    .modal-content
      .modal-header
        button.close(type='button', data-dismiss='modal', aria-hidden='true') ×
        h4.myModalLabel.modal-title 
        | #{title}
      .modal-body
          #container(style="width:90%; height:400px;")
      .modal-footer
        button.btn.btn-primary(type='button', data-dismiss='modal') Close
script.
  $(document).ready(function(){

    if(#{strikeprices}){
      $('#myModal').modal('show')
    }

    $('body').on('hidden.bs.modal', '.modal', function () {
      $(this).removeData('bs.modal');
    });
  });

How to Submit other Modal form on Submit Button click of Current Modal


Tag : javascript , By : Martin Kopp
Date : March 29 2020, 07:55 AM
this one helps. I have a Bootstrap Modal which contains a Submit Button.Apart from this Modal I have another one also which contains Form and other elements like Lables, Text boxes and a Submit button.Now I have a requirement where in a click Submit button of first Modal , it should submit the Form of the Second Modal..Below I am posting my First and Second Modal HTML Prototype .. , Adding a class to delete button
<button type="submit" class="btn btn-success delete"><i class="glyphicon glyphicon-trash"></i> Delete</button>
$('.delete').on('click',function(){
    $('#DeleteModal').modal('hide');
    $("#frmStudent").submit();
});

Blazor EditForm Submit handler not called when the form is in a bootstrap modal end the submit button is the modal dismi


Tag : development , By : Jim Davis
Date : March 29 2020, 07:55 AM
seems to work fine Your biggest issue is using bootstrap as is. BS uses it’s own JS to manipulate the DOM, this won’t work with Blazor as Blazor needs to control the DOM. Same as Angular, React or Vue. If something else modifies the DOM then odd things can happen, as you’re finding.
I would suggest swapping to one of the Blazor-fied bootstrap libraries such as BlazorStrap. Or if you’re just after a modal I’ve written one called Blazored.Modal

how to remove the default focus on submit button in HTML form?


Tag : javascript , By : user176445
Date : March 29 2020, 07:55 AM
Related Posts Related QUESTIONS :
  • Launch local executable from web browser
  • How to prepare array of json objects to d3 hierarchical tree structure
  • VueJS - event emitted - show HTML before other calculations
  • Export SASS/SCSS variables to Javascript without exporting them to CSS
  • How to attach an event handler only once continuously
  • How to make button open a link in new tab in JavaScript?
  • Find range from the javascript object
  • How can I use my jQuery code as JavaScript?
  • How to show 5 images in a 2 row slider with bxslider
  • How to convert stream into variables in typescript
  • Three.js custom shader error on Chrome GL_INVALID_OPERATION: Active draw buffers with missing fragment shader outputs
  • My JavaScript doesn't work. How can I solve this problem?
  • Why is this async function is running synchronously?
  • Get updated variable from within react hook before return
  • I want to show all image preview but whenever I upload a new one the old one is gone
  • Would I be able to give access to specific electron APIs safely?
  • Why several clicks fire for each instance of a Class?
  • cant grab value from div using attr()
  • Make web service not accessible by browser?
  • Select DOM elements within template
  • How to customize angular ui-grid row background color?
  • Binding data in two respective $scope in AngularJS, how?
  • react put some props after import class
  • Variable is distributed among same components
  • switch class in jQuery/JavaScript for active/inactive state
  • How To Track Outbound Clicks Using Javascript
  • How to get total seconds elapsed since the beginning of the month?
  • Protractor: Stale element reference at "browser.wait(EC.visibilityOf(confDial), FIFTY_SECONDS);"
  • Access to an array inside an object
  • Reseting an JavaScript Interval with different value?
  • Learning Angular for the first time - version 2 or 4?
  • Rendering RSS feed (XML) in React with jquery, why do object values parsed from the feed seem empty?
  • Node.js xml2js http.request tag matching
  • applying texture to custom plane geometry in Threejs
  • How do I pass an Event as a function parameter in HTML written inside JavaScript variable?
  • Interface of object parameter with default value and default property
  • Does using try / catch rather than `.catch` observable operator with XHR requests reduce performance?
  • In IE11 background colors not working on printing
  • TypeScript interface signature "(): string"
  • Is synchronous XMLHttpRequest supported in Internet Explorer 10 and 11?
  • Axios function not returning any values with js
  • How to use firestore TIMESTAMP to create time-stamp in JavaScript
  • Instantiate subclass without constructing
  • Outputing a created object in javascript to a server side JSON file
  • Transition the numeric labels in a bar chart
  • createBottomTabNavigator: hide just one tab from the tabBar
  • iife vs simple statement behavior with document.title
  • showDialogPopup Refresh Page after Click
  • Child component does not set the initial value passed from the parent: ReactJS
  • Nodejs javascript added to button not responding
  • Trying to define a promise.all
  • Python GEE to extract featurecollection timeseries from Landsat imageries
  • How to write negative binary number?
  • Unable to set property of individual object
  • Why Named Function Expression itself cannot assign Name to another Value?
  • How to reset scroll position on single page pagination
  • How to scroll to bottom of page, when a new message is sent - Socket.io
  • How to reconstruct audio blob from a base64 encoded String?
  • How to calculate numbers within an array of objects
  • Using JavaScript to change CSS properties of SVG circles for all circles that was not clicked
  • shadow
    Privacy Policy - Terms - Contact Us © scrbit.com