Surendra Sharma

Surendra Sharma

Search This Blog

Thursday, February 23, 2017

Post WFFM form if submit button is hidden

Once you hide WFFM form Submit button, then how to call its Submit action on click of MVC form Submit button.

Below java script done the magic for this

if ($(".form-submit-border").length > 0) {
   $(".form-submit-border > .btn").trigger('click');

Here is the complete code for scenario

HTML in View

<button class="submit" id="product-create-button" onclick="return CreateProduct();" type="submit">Submit</button>


function CreateProduct() {

        var param = {
            productItemId: $("#product-select").val(),
            quality: $("#quality-select").val(),

            dataType: 'json',
            type: 'POST',
            async: false,
            url: _rootUrl + '/product/create',
            data: param,
            success: function (result) {
                if ($(".form-submit-border").length > 0) {
                    $(".form-submit-border > .btn").trigger('click');
            error: function (response, ajaxOptions, thrownError) {
    return false;

I am calling Javascript method on click of MVC form Submit button. Its send the required data to Controller action method via AJAX call. On success of AJAX operation, I am triggering click event of WFFM form Submit button which eventually call WFFM Execute action.

I hope you like this Sitecore tip. Stay tuned for more Sitecore related articles.

Till that happy Sitecoring :)

Please leave your comments or share this tip if it’s useful for you.

No comments:

Post a Comment