Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > สอบถามการใช้งาน jQuery Validate ร่วมกับ jConfirm ครับ พอมันขึ้นข้อความ Confirm แล้วกด OK มันไม่ Submit ต่อเลยครับ



 

สอบถามการใช้งาน jQuery Validate ร่วมกับ jConfirm ครับ พอมันขึ้นข้อความ Confirm แล้วกด OK มันไม่ Submit ต่อเลยครับ

 



Topic : 117334



โพสกระทู้ ( 266 )
บทความ ( 0 )



สถานะออฟไลน์




สอบถามการใช้งาน jQuery Validate ร่วมกับ jConfirm ครับ พอมันข้อ Confirm แล้วกด OK มันไม่ Submit ต่อเลยครับ

สคริป Validate
http://www.position-relative.net/creation/formValidator/

สคริป jConfirm
http://labs.abeautifulsite.net/archived/jquery-alerts/demo/

โค้ด
Code (PHP)
$(function(){
	$('#form1').validationEngine('attach',{
		onValidationComplete: function(form, status){		
			if(status){
				jConfirm('ตรวจสอบข้อมูลแล้ว', 'Confirm Dialog', function(r){
					if(r){
						$('#form1').submit(); <!-- พอถึงตรงนี้ไม่ทำงาน form ไม่ submit
					}
				});
			}
		}
	});
});

<form action="xxx.php" method="post" name="form1" id="form1">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
    <tbody>
      <tr>
      	<th awidth="20%" align="right" valign="top">ชื่อ :</th>
        <td width="80%" valign="middle"><input   type="text" id="user_name"  name="user_name" placeholder="ชื่อ" class="validate[required]" /></td>
      </tr>
      <tr>
      	<th align="right" valign="top">นามสกุล :</th>
        <td><input   type="text" id="user_sname"  name="user_sname" placeholder="นามสกุล" class="validate[required]" /></td>
      </tr>
      <tr>
      	<th></th>
        <td><button type="submit" class="btn" id="submit"><i class="cus-disk"></i> บันทึก</button></td>
      </tr>
    </tbody>
</table>
</form>




Tag : PHP, jQuery







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2015-06-23 12:16:59 By : 9nonameman View : 910 Reply : 6
 

 

No. 1



โพสกระทู้ ( 5,105 )
บทความ ( 4 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


Validators. = jQuery v1.7.2
jquery-alerts = jQuery v1.2.6

ตอนนี้ให้ jQuery เวอร์ชั่นไหนเป็นหลัก ลองสลับกันดูครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-23 12:48:16 By : apisitp
 


 

No. 2



โพสกระทู้ ( 266 )
บทความ ( 0 )



สถานะออฟไลน์


เวอร์ชั่น jQuery v1.7.2 ครับ

คือทั้งสองตัวมันทำงานได้ปกติน่ะครับ

แต่ที่มันไม่ได้คือ เมื่อ Alert Confirm ขึ้นมาเสร็จแล้ว จะมีให้เลือก Ok / Cancel พอเลือก Ok

ผมจะให้มัน Submit form ตรง นี้ล่ะครับที่มันไม่ไป
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-23 13:27:21 By : 9nonameman
 

 

No. 3



โพสกระทู้ ( 5,105 )
บทความ ( 4 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


$("#confirm_button").click( function() { jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) { jAlert('Confirmed: ' + r, 'Confirmation Results'); /* สังเกตุว่ามัน alert ค่า r ก็เอา r มาเล่นครับ */ if(r == false){ alert('false'); return false; }else{ $('#form1').submit(); } }); });


ลองดูครับ
$(function(){
	$('#form1').validationEngine('attach',{
		onValidationComplete: function(form, status){		
			if(status){
				jConfirm('ตรวจสอบข้อมูลแล้ว', 'Confirm Dialog', function(r){
				    if(r == false){
								//alert('false');
								return false;
							}else{
								$('#form1').submit();
							}

				});
			}
		}
	});
});

<form action="xxx.php" method="post" name="form1" id="form1">
<table width="100%" border="0" cellspacing="3" cellpadding="3">
    <tbody>
      <tr>
      	<th awidth="20%" align="right" valign="top">ชื่อ :</th>
        <td width="80%" valign="middle"><input   type="text" id="user_name"  name="user_name" placeholder="ชื่อ" class="validate[required]" /></td>
      </tr>
      <tr>
      	<th align="right" valign="top">นามสกุล :</th>
        <td><input   type="text" id="user_sname"  name="user_sname" placeholder="นามสกุล" class="validate[required]" /></td>
      </tr>
      <tr>
      	<th></th>
        <td><button type="submit" class="btn" id="submit"><i class="cus-disk"></i> บันทึก</button></td>
      </tr>
    </tbody>
</table>
</form>



ประวัติการแก้ไข
2015-06-23 14:16:56
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-23 14:14:15 By : apisitp
 


 

No. 4



โพสกระทู้ ( 266 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 3 เขียนโดย : apisitp เมื่อวันที่ 2015-06-23 14:14:15
รายละเอียดของการตอบ ::
ขอบคุณครับ แต่ก็ยังไม่ได้เหมือนเดิม

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-23 14:53:53 By : 9nonameman
 


 

No. 5



โพสกระทู้ ( 5,105 )
บทความ ( 4 )

สมาชิกที่ใส่เสื้อไทยครีเอท Hall of Fame 2012

สถานะออฟไลน์


ตัวเต็มที่ผมไปก็อปมา แล้วลองทดสอบ....ผ่านได้ด้วยดี
ไม่งั้นมีอีกจุดนึงคือ.....

ตัวหลักจากเว็บ : <input id="confirm_button" type="button" value="Show Confirm" />
ของเว็บท่าน: <button type="submit" class="btn" id="submit"><i class="cus-disk"></i> บันทึก</button>

จาก code จริงๆของท่าน ลอง alert(r); ดูว่ามันแสดงค่าไหม


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
		<title>jQuery Alert Dialogs</title>
		<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
		<meta name="description" content="This is a demonstration page." />
		<meta name="keywords" content="alert, confirm, prompt, demo" />

		<style type="text/css">
			BODY,
			HTML {
				padding: 0px;
				margin: 0px;
			}
			BODY {
				font-family: Arial, Helvetica, sans-serif;
				font-size: 12px;
				background: #FFF;
				padding: 15px;
			}

			H1 {
				font-size: 20px;
				font-weight: normal;
			}

			H2 {
				font-size: 16px;
				font-weight: normal;
			}

			FIELDSET {
				border: solid 1px #CCC;
				-moz-border-radius: 16px;
				-webkit-border-radius: 16px;
				border-radius: 16px;
				padding: 1em 2em;
				margin: 1em 0em;
			}

			LEGEND {
				color: #666;
				font-size: 16px;
				padding: 0em .5em;
			}

			PRE {
				font-family: "Courier New", monospace;
				font-size: 11px;
				color: #666;
				background: #F8F8F8;
				padding: 1em;
				-moz-border-radius: 8px;
				-webkit-border-radius: 8px;
				border-radius: 8px;
			}

			/* Custom dialog styles */
			#popup_container.style_1 {
				font-family: Georgia, serif;
				color: #A4C6E2;
				background: #005294;
				border-color: #113F66;
			}

			#popup_container.style_1 #popup_title {
				color: #FFF;
				font-weight: normal;
				text-align: left;
				background: #76A5CC;
				border: solid 1px #005294;
				padding-left: 1em;
			}

			#popup_container.style_1 #popup_content {
				background: none;
			}

			#popup_container.style_1 #popup_message {
				padding-left: 0em;
			}

			#popup_container.style_1 INPUT[type='button'] {
				border: outset 2px #76A5CC;
				color: #A4C6E2;
				background: #3778AE;
			}

		</style>

		<!-- Dependencies -->
		<script src="http://labs.abeautifulsite.net/archived/jquery-alerts/demo/jquery.js" type="text/javascript"></script>
		<script src="http://labs.abeautifulsite.net/archived/jquery-alerts/demo/jquery.ui.draggable.js" type="text/javascript"></script>

		<!-- Core files -->
		<script src="http://labs.abeautifulsite.net/archived/jquery-alerts/demo/jquery.alerts.js" type="text/javascript"></script>
		<link href="http://labs.abeautifulsite.net/archived/jquery-alerts/demo/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />

		<!-- Example script -->
		<script type="text/javascript">

			$(document).ready( function() {

				$("#alert_button").click( function() {
					jAlert('This is a custom alert box', 'Alert Dialog');
				});

				
				$("#confirm_button").click( function() {
					jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
						jAlert('Confirmed: ' + r, 'Confirmation Results');
							
							if(r == false){
								alert('false');
								return false;
							}else{
								$('#form1').submit();
							}

							});
					});
				
		
				$("#prompt_button").click( function() {
					jPrompt('Type something:', 'Prefilled value', 'Prompt Dialog', function(r) {
						if( r ) alert('You entered ' + r);
					});
				});

				$("#alert_button_with_html").click( function() {
					jAlert('You can use HTML, such as <strong>bold</strong>, <em>italics</em>, and <u>underline</u>!');
				});

				$(".alert_style_example").click( function() {
					$.alerts.dialogClass = $(this).attr('id'); // set custom style class
					jAlert('This is the custom class called &ldquo;style_1&rdquo;', 'Custom Styles', function() {
						$.alerts.dialogClass = null; // reset to default
					});
				});
			});

		</script>

	</head>

	<body>

		<h1>jQuery Alert Dialogs (Alert, Confirm, &amp; Prompt Replacements)</h1>

		<h2>Basic Examples</h2>

		<fieldset>
			<legend>Alert</legend>
<pre>
jAlert('This is a custom alert box', 'Alert Dialog');
</pre>
			<p>
				<input id="alert_button" type="button" value="Show Alert" />
			</p>
		</fieldset>

<form action="xxx.php" method="post" name="form1" id="form1">
		<fieldset>
			<legend>Confirm</legend>
<pre>
jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
    jAlert('Confirmed: ' + r, 'Confirmation Results');
});
</pre>
			<p>
				<input id="confirm_button" type="button" value="Show Confirm" />
			</p>
		</fieldset>

		<fieldset>
			<legend>Prompt</legend>
<pre>
jPrompt('Type something:', 'Prefilled value', 'Prompt Dialog', function(r) {
    if( r ) alert('You entered ' + r);
});
</pre>
			<p>
				<input id="prompt_button" type="button" value="Show Prompt" />
			</p>
		</fieldset>
</form>


		<h2>Additional Examples</h2>
		<fieldset>
			<legend>With HTML</legend>
<pre>
jAlert('You can use HTML, such as <strong>bold</strong>, <em>italics</em>, and <u>underline</u>!');
</pre>
			<p>
				<input id="alert_button_with_html" type="button" value="Show Alert" />
			</p>
		</fieldset>

		<fieldset>
			<legend>Alternate Styles</legend>
			<p>
				By changing the value of the <samp>$.alerts.dialogClass</samp> property (and creating
				your own CSS class), you can changes the style of your dialogs:
			</p>

			<p>
				<input id="style_1" class="alert_style_example" type="button" value="Style 1" />
			</p>

			<p>
				View the plugin source for additional properties that can be modifed at runtime.
			</p>
		</fieldset>

	</body>

</html>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-23 15:08:22 By : apisitp
 


 

No. 6



โพสกระทู้ ( 266 )
บทความ ( 0 )



สถานะออฟไลน์


ครับ ตอบความคิดเห็นที่ : 5 เขียนโดย : apisitp เมื่อวันที่ 2015-06-23 15:08:22
รายละเอียดของการตอบ ::
ขอบคุณครับ รู้ล่ะ มันเป็นที่มันอยู่ภายใต้

Code (PHP)
$('#form').validationEngine('attach',{
		onValidationComplete: function(form, status){


แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2015-06-23 15:52:02 By : 9nonameman
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : สอบถามการใช้งาน jQuery Validate ร่วมกับ jConfirm ครับ พอมันขึ้นข้อความ Confirm แล้วกด OK มันไม่ Submit ต่อเลยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่