Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

I need to a javascript or another web popup box that works like a windows message box

Posted on 2014-09-12
2
272 Views
Last Modified: 2014-10-09
I need a way to display popup box much like a windows message box that when a submit button is clicked it checks if a textbox contians certian words. If the textboxes does then a popup box comes up asking the user if they want to continue the operation or return back to the webpage.
Below is the code that I have worked out if I could use a windows message box, I know that you can't use a windows box in a web applicaion. However, below is how I would like for the popup box to work.
if (txtWebinarCourseName.Text.Contains("Servicing") || txtWebinarCourseName.Text.Contains("Your Book") || txtWebinarCourseName.Text.Contains("Advanced")
                                 || txtWebinarCourseName.Text.Contains("Billing") || txtWebinarCourseName.Text.Contains("EA/EFS") || txtWebinarCourseName.Text.Contains("The EA/EFS Partnership")
                                 || txtWebinarCourseName.Text.Contains("Compliance") || txtWebinarCourseName.Text.Contains("IS Appeals")
                                 || txtWebinarCourseName.Text.Contains("Who to Contact") || txtWebinarCourseName.Text.Contains("My Work Items")
                                 || txtWebinarCourseName.Text.Contains("Quote-Requote Process") || txtWebinarCourseName.Text.Contains("New Customer")
                                 || txtWebinarCourseName.Text.Contains("On-Boarding") || txtWebinarCourseName.Text.Contains("Allstate Claims")
                                 || txtWebinarCourseName.Text.Contains("Property Re-inspection Initiative ") || txtWebinarCourseName.Text.Contains("Reports and Compensation")
                                 || txtWebinarCourseName.Text.Contains("Know Your Numbers") || txtWebinarCourseName.Text.Contains("Risk Management")
                                 || txtWebinarCourseName.Text.Contains("West Central"))
                            {
                                string messageBoxText = "The course name you entered is simular to an exsisting course: " + txtWebinarCourseName.Text + "Do you want to continue?";
                                string caption = "Verify Course Name";
                                MessageBoxButtons button = MessageBoxButtons.YesNo;
                                MessageBoxIcon icon = MessageBoxIcon.Question;

                                // Display message box
                                DialogResult result = MessageBox.Show(messageBoxText, caption, button, icon);

                                // Process message box results 
                                switch (result)
                                {
                                    case DialogResult.Yes:
                                        // User pressed Yes button 
                                        SubmitWebinar(false);
                                        break;
                                    case DialogResult.No:
                                        // User pressed No button 
                                        break;
                                }

Open in new window

0
Comment
Question by:newjeep19
  • 2
2 Comments
 
LVL 82

Expert Comment

by:leakim971
ID: 40320360
basically you block the execution of any code in a page using a message box (alert, confirm,prompt)
all block the execution of the code until the user clock ok or cancel if available

the other box available you can find don't work like that, they use a callback function executed when the user click on a button.

so we have :

 // Display message box
                                DialogResult result = MessageBox.Show(messageBoxText, caption, button, icon, callbackFunction);

with somewhere you declare :
function callbackFunction(result) {
                                // Process message box results 
                                switch (result)
                                {
                                    case DialogResult.Yes:
                                        // User pressed Yes button 
                                        SubmitWebinar(false);
                                        break;
                                    case DialogResult.No:
                                        // User pressed No button 
                                        break;
                                }
}

Open in new window

0
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 40320368
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question