Solved

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

Posted on 2014-09-12
2
278 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…

705 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