Solved

display dialog box using jquery ui after submitting a form

Posted on 2014-11-06
2
411 Views
Last Modified: 2014-11-11
I am currently submitting a form based on the select box selected option by setting the form action. When I hit the submit button the form is getting submitted correctly but I am looking to display a dialog box saying some confirmation message. This is where I am stuck. here is the mark up for my form and the jQuery

First HTML

<div id="mc_embed_signup">
<form method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>
    <div id="mc_embed_signup_scroll">
<div class="indicates-required"><span class="asterisk">*</span> indicates required</div>
<div class="mc-field-group">
	<label for="mce-EMAIL">Email Address  <span class="asterisk">*</span>
</label>
	<input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL">
</div>
<div class="mc-field-group">
	<label for="mce-FNAME">First Name </label>
	<input type="text" value="" name="FNAME" class="" id="mce-FNAME">
</div>
<div class="mc-field-group">
	<label for="mce-LNAME">Last Name </label>
	<input type="text" value="" name="LNAME" class="" id="mce-LNAME">
</div>
<div class="mc-field-group">
	<select id="listid">
		  <option>Choose an Email List</option>
		  <option id="local">Local Customers</option>
		  <option id="nonlocal">Internet Customers from Out of State</option>
		  <option id="tourists">Customers from Outside Our Area, but Visit Often</option>
		 </select>
</div>
	<div id="mce-responses" class="clear">
		<div class="response" id="mce-error-response" style="display:none"></div>
		<div class="response" id="mce-success-response" style="display:none"></div>
	</div>    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
    <div style="position: absolute; left: -5000px;"><input type="text" name="b_e7f9ac4d5ea3363c1395539dd_db62125046" tabindex="-1" value=""></div>
    <div class="clear"><input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button"></div>
    </div>
</form>
</div>

Open in new window


Here my jQuery Mark up

<script type="text/javascript">
$(document).ready(function(){
 //Function to change Form Action
	$("#listid").change(function(){
		var selected = $(this).children(":selected").text();
		switch(selected){
		case "Local Customers":
		$("#mc-embedded-subscribe-form").attr('action','/text.html/subscribe/post?u=e7f9ac4d5ea3363c1395539dd&amp;id=db62125046');
		$("#h2text").text("Local Customers :)");
		break;		
		case "Internet Customers from Out of State":
		$("#mc-embedded-subscribe-form").attr('action','/text.html/subscribe/post?u=e7f9ac4d5ea3363c1395539dd&amp;id=fad7d5dc8a');
		$("#h2text").text("Internet Customers from Out of State :)");
		break;		
		case "Customers from Outside Our Area, but Visit Often":
		$("#mc-embedded-subscribe-form").attr('action','/text.html/subscribe/post?u=e7f9ac4d5ea3363c1395539dd&amp;id=fdff0e10d2');
		$("#h2text").text("Customers from Outside Our Area, but Visit Often :)");
		break;		
		default:
		$("#mc-embedded-subscribe-form").attr('action','#');		
		
	}		
	});
	
	//Function For Back Button
		$(".back").click(function(){
		 parent.history.back();
		 return false;
		 });
		
	});
</script>

Open in new window


I have dialog box like beloq
	<div id="dialog" title="Almost Finished...">
	<h2 id="h2text"></h2>
    <p>Almost finished...<br />
    We need to confirm your email address.<br /><br />
    To complete the subscription process, please click the link in the email we just sent you.<br /><br />
  	</div>

Open in new window


I am looking to show this Dialog box on submission of the form.

Thanks
0
Comment
Question by:niceoneishere
[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 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 500 total points
ID: 40426932
you have 2 options, submit the form via ajax, then display the dialog, or on the submitted page, detect on page load if the page has been submitted, then display the dialog there
0
 
LVL 1

Author Closing Comment

by:niceoneishere
ID: 40436163
Thanks
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
title attribute 5 33
Display Flex does not Wrap Items 2 40
Sending HTML Formatted Email from ASP.NET 2 47
Add Promise to Existing Code 6 24
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

740 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