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

  • Home
  • SEARCH
  • 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 6341121
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:58:05+00:00 2026-05-24T19:58:05+00:00

Using jquery alerts dialog plugin , how do I send a value in a

  • 0

Using jquery alerts dialog plugin, how do I send a value in a form that is displayed in an alert, to a callback feature? The form is in the alert, and the callback happens after I click OK.

This is code that works, ignore this code as it is a working example, it basically shows how a form can be serialised. This code is taken from the Jquery documentation from the .serialise page. The problematic code goes below this.

<?php $moveablecats = mysql_query("SELECT * FROM categories WHERE id != '1'  "); ?><form id="changecategoryForm2"><select id="newflex" name="thecatidichose"> <option value=""></option> <?php while($catrow =mysql_fetch_array($moveablecats)){ ?> <option value="<?php echo "$catrow[id]"; ?>"><?php echo "$catrow[title]"; ?> </option><?php } ?></select>  </form>   <p><tt id="results"></tt></p>


<script>
    function showValues() {
      var str = $("form#changecategoryForm2").serialize();
      $("#results").text(str);
    }
    $(":checkbox, :radio").click(showValues);
    $("select").change(showValues);
    showValues();
</script>

Compare that working code to the one I have with the Jquery alerts dialog plugin below the next code.
Below is the default code to show an alert.

jPrompt('Type something:', 'Prefilled value', 'Prompt Dialog', function(r) {
    if( r ) alert('You entered ' + r);
});

This is me putting the working html code of the form above into the alert, a type of javascript alert called a prompt.

The variable that I am trying to pass to the callback function is a serialised form called with the id of changecategoryForm.

  • Note that the working example above
    is a form called
    changecategoryForm2
  • The problematic form below is called
    changecategoryForm

Here is the problematic code.

$(".changecategory").click( function() {
   <?php $moveablecats = mysql_query("SELECT * FROM categories WHERE id != '1'  "); ?>
   var categoryid = $(this).attr("categoryid");
   var itemid = $(this).attr("itemid");
   var itemid2 = $(this).attr("itemid");
   var itemtitle = $(this).attr("itemtitle");
   var parenttag = $(this).parent().get(0).tagName;
   var removediv = "itemid_" +itemid;   
   jAlert(
      'Which category do you want to move <b>'+itemtitle+ '</b> to?<br><?php $moveablecats = mysql_query("SELECT * FROM categories WHERE id != '1'  "); ?><form id="changecategoryForm"><select id="newflex" name="thecatidichose"> <option value=""></option> <?php while($catrow =mysql_fetch_array($moveablecats)){ ?> <option value="<?php echo "$catrow[id]"; ?>"><?php echo "$catrow[title]"; ?> </option><?php } ?></select>  </form>   <p><tt id="results"></tt></p>','Change category', function(r)    {
         // $(parenttag).fadeOut('slow');  
         $("#"+removediv).fadeOut('slow');  

         var newflex = $("#newflex").val();
         alert(newflex); // this shows nothing    
         alert($("#changecategoryForm").serialize());
         alert('categoryid ' + categoryid + ' itemid ' + itemid + '.'); //this shows the variables

         jAlert(''+ itemtitle +' has been successfully moved.', 'Success');
      } // this brace closes function(r)
   ); 
});
  • 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-05-24T19:58:06+00:00Added an answer on May 24, 2026 at 7:58 pm

    I solved it myself by refactoring my code.
    Thanks for your time anyway.
    The End.

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

Sidebar

Related Questions

I have a form which is using swfupload with the jquery plugin. I have
I'm using the jquery form plugin to submit forms to my MVC application. The
I am using jquery dialog to submit a form to a db and what
I'm using jQuery UI dialog. I have a delete form as follows: @using (Ajax.BeginForm(DeleteUser,
I have a form inside a dialog that appears after clicking in another button.
I am using jQuery dialog plugin because i need to make decision upon user
I am using jquery validate plugin to validate dynamically loaded form. For some cases
I am using jquery dialog to display my form and I use MVC 3
I am showing lots of form using jquery dialog and I wish to add
I want to submit a form using jquery .post() . I want to send

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.