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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:52:12+00:00 2026-06-02T21:52:12+00:00

I have the following code: $.modal({ title: title, closeButton: true, content: content, complete: function

  • 0

I have the following code:

 $.modal({
                    title: title,
                    closeButton: true,
                    content: content,
                    complete: function () {
                        applyTemplateSetup();
                        $('#main-form').updateTabs();
                        $('#main-form').data('action',action);
                        // updated to line below but still does not work
                        $('#main-form').data('action','Edit');
                    },
                    width: 900,
                    resizeOnLoad: true,
                    buttons: {
                        'Submit': function (win) {
                            formSubmitHandler($('#main-form')); 
                        },
                    }

Once my data is loaded I am trying to set the data attribute action. I then have more code that reads it in the submit handler:

var formSubmitHandler = function (form) {

    //e.preventDefault();
    var $form = form;
    var val = $form.valid();
    if (!$form.valid || $form.valid()) {

        var submitBt = $(this).find('button[type=submit]');
        submitBt.disableBt();
        var sendTimer = new Date().getTime();

        $.ajax({
            url: $form.attr('action'),
            dataType: 'json',
            type: 'POST',
            data: $form.serializeArray(),
            success: function (json, textStatus, XMLHttpRequest) {
                json = json || {};
                if (json.success) {
                    if ($form.data('action') == "Edit") {
                        $('#modal').removeBlockMessages()
                        submitBt.enableBt();
                    } else {

However it seems the value is not being set correctly as when I step through the code this is not getting a true value: $form.data('action') == "Edit". Am I doing something wrong?

  • 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-02T21:52:14+00:00Added an answer on June 2, 2026 at 9:52 pm

    This might be the issue.

    First you do – $('#main-form').data('action',action);
    I’m not entirely sure what the actionvariable holds, but from this line of your code – url: $form.attr('action') I’m going to assume you’re giving the form action value. Why you do that is your concern, but I do believe it does not == "Edit".

    What value do you get in your $form.data('action') ?

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

Sidebar

Related Questions

I have the following code: var modal = $.modal({ title: title, closeButton: true, content:
I have the following code in a Google map script... <a class='btn btn-modal' data-target='popup.html'>Go</a>
I have the following code; // open the modal when an element with a
I am using the following code to post my form data to player/index.php and
I have the following html code: <div class= modal id=indexModal> <span class=thing></span> <a href=#
I currently have the following code. Basically, just a login page and a modal
I have the following code that I use to create a dialog box: (function
Issue: not able to close modal dialog I have the following code, it works
I have the following code: <div id=leaving-dialog title=Confirmation Required> <p>You are now leaving the
I have the following code in my document ready: $('a').click(function(e) { e.preventDefault(); var $this

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.