Solved

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

Posted on 2014-09-12
2
273 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
[X]
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
  • 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
arrays and buttons with user input 2 34
Session on Html 8 42
How to set focus on a dynamic control 18 28
Javascript: Range object 16 16
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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…

730 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