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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:00:34+00:00 2026-06-10T16:00:34+00:00

Problem We need to give facility on lightbox to cancel the form submission or

  • 0

Problem We need to give facility on lightbox to cancel the form submission or provide extra information to continue with form submissions.

Detailed Requirements I’ve a HTML form. Before form is submitted, we need to show a lightbox, to ask some extra information from the user. In simple words, I need synchronous behaviour in a Javascript function. I know it is not expected JS behavior but I’m also sure it is possible and someone must had achieved it by one way or other. How can we do that.

Code looks like following, hope is clears the problem better.

//This is called when submit button is clicked.
$('.mbutton').bind('click', function(e){
    var subButton = e.target || e.srcElement || e.originalTarget;
    var value = subButton.id;

    //If submit button pressed.
    if (value == "Publish"){
        //custom JQuery plugin to open light box.
        $.siddlb('#puboptions',{});
        //Lightbox opens but soon form too submits and new page gets loaded. Requirements are, function must wait here until light box is closed.
    }

    //Below task should execute only if user provide required information in lightbox.
    finalize();
    try{
        if (value == "Publish"){
            var canvas = document.getElementById("imageView");
            var context = canvas.getContext("2d");
            var img     = canvas.toDataURL("image/png");
            document.getElementById("textimage").value = img;            
        }
        //$("#myaction").val(subButton.id);
        $("#myaction").val('Publish');
    }catch(e){
        $("#myaction").val("Cancel");                   
    }
});
  • 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-10T16:00:35+00:00Added an answer on June 10, 2026 at 4:00 pm

    I guess your publish button (as name suggest) is form’s submit button.

    There might be different ways but if I were you, I would have make publish button as simple button like

    <button class="mbutton" id="publish">Publish</button>
    

    On its click, do whatever you want to do in the lightbox. Just place another button in lightbox like ‘continue’ and on its click, submit the form through javascript.

    This is very simple and straight forward solution, may be you are looking for some other solution. Please let me know if you find other solution.

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

Sidebar

Related Questions

There is a problem with the following code. I need it to give access
I have a with problem div and jquery . I need to give focus
I have a problem where I always need to give simple access to my
Goal: Gain datatype date with year and month Problem: Need to help to convert
Problem: I need to write/read objects from a file.This because I need to write/read
The problem: I need to ensure that a particular directory hierarchy exists in the
My problem : I need to create draggable widgets (here it's a jslider for
To solve some problem I need to compute a variant of the pascal's triangle
I faced a problem - I need to use a macro value both as
I have problem i need to convert from my Array structure to std::vector<int> ...

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.