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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:01:25+00:00 2026-06-12T22:01:25+00:00

I am using Spring MVC and i would like when i insert a record

  • 0

I am using Spring MVC and i would like when i insert a record into the database via a POST when the user is returned to the view i would like to show something like a Jquery dialog to the user that says the transaction was successful/display an error message to the use in the dialog.

I implemented the Jquery dialog but for some reason its not working the way i would like it to. I have created it like this :

jquery

 function ShowDialog() {
            $( "#dialog" ).dialog({
                modal: true,
                buttons: {
                    Ok: function() {
                        $( this ).dialog( "close" );
                    }
                }
            });
        }

I attached this to an element event when change:

$('#results').change(function()){

            if($('#results').val().length != 0){

                ShowDialog();


            }


        }    

However when the form loads i get a blank dialog popping up. The element ‘results‘ is empty and gets set form the server using model.addAttribute(“results”,”Record Was Updated”) and where the i created named ‘dialog’ is located i can see the dialog icon being displayed.

html

<div id="dialog" title="Server Response">
            <p>
                <span class="ui-icon ui-icon-info" style="float: left; margin: 0 7px 50px 0;"></span>
                <label id="results">${results}</label>
            </p>

</div>
  • 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-12T22:01:27+00:00Added an answer on June 12, 2026 at 10:01 pm

    In your change event change the second line to this:

    if($('#results').html().length != 0){
    

    The .val() only works for form elements (input, select and textarea), whereas #results is a normal html element.

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

Sidebar

Related Questions

I would like to test my Spring MVC 3.0.1 application using * junit-4.10. *jar
I would like to share Session Attributes betweet two Controllers in Spring MVC, using
We are using Spring MVC and we would like to build an Application that
I am using Spring MVC for my project and would like to use Apache
I would like to configure spring MVC application using Spring security the following way.
I'm using spring MVC (spring 3.1.0). I would like to html encode every string
I'm using Spring MVC (3.0) with annotation-driven controllers. I would like to create REST-ful
I am using Spring framework mvc 3 + spring security 3. I would like
I am using spring mvc in my application,when i created user i have to
I'm using Spring MVC and jquery autocomplete, my spring controller looks like this @RequestMapping(value

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.