+ com_asyncform +資産 + css -common.css + js -common.js -mootools-1.2.1-core.js +コントローラー -default.php +モデル -asyncform.php +ビュー + tmpl -default.php -view.html.php -asyncform.php
asyncform.php
<?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?><?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?>
<?phpdefined ( '_JEXEC' ) or die ( 'Restricted access' ) ;if ( $controller = JRequest :: getVar ( 'controller' ) ) {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . $controller . '.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . $controller . DS . 'view.html.php' ) ;}else {require_once ( JPATH_COMPONENT . DS . 'controllers' . DS . 'default.php' ) ;require_once ( JPATH_COMPONENT . DS . 'models' . DS . 'asyncform.php' ) ;require_once ( JPATH_COMPONENT . DS . 'views' . DS . 'default' . DS . 'view.html.php' ) ;}// Create the controller$classname = 'AsyncformController' . $controller ;$controller = new $classname ;$controller -> execute ( JRequest :: getVar ( 'task' ) ) ;$controller -> redirect ( ) ;?>
コントローラー/ default.php
<?phpjimport ( 'joomla.application.component.controller' ) ;クラス AsyncformController は JControllerを拡張します{function __construct ( $ default = array ( ) ) {親 :: __construct ( $ default ) ;$ this- > registerDefaultTask ( 'display' ) ;$ this- > registerTask ( 'check' 、 'check' ) ;}関数キャンセル( ) {$ this- > setRedirect ( 'index.php' ) ;}関数表示( ) {$ view = new AsyncformView ( ) ;$ view- > display ( ) ;}機能チェック( ) {$ isValid = false ;$ res [ 'type' ] = '' ;$ res [ 'msg' ] = '' ;$ res [ 'items' ] = array ( ) ;$ name = substr ( JRequest :: getVar ( 'name' ) 、 0、50 ) ;if ( ereg ( '[a-aaA-aa-zA-Z \-] + $' 、 $ name ) ) {$ res [ 'items' ] [ ] = array ( 'name' => 'name' 、 'status' => 1 ) ;$ isValid = true ;}その他 {$ res [ 'items' ] [ ] = array ( 'name' => 'name' 、 'status' => 0 ) ;$ isValid = false ;}$ email = strtolower ( substr ( JRequest :: getVar ( 'email' ) 、 0、50 ) ) ;if ( ereg ( '^ [^ 0-9] [a-z0-9 _ \-\。] + @ [^ 0-9] [az \-\。] + \。[az] {2,4} $ ' 、 $ email ) ) {$ res [ 'items' ] [ ] = array ( 'name' => 'email' 、 'status' => 1 ) ;$ isValid = true ;}その他 {$ res [ 'items' ] [ ] = array ( 'name' => 'email' 、 'status' => 0 ) ;$ isValid = false ;}if ( $ isValid ) {$ res [ 'type' ] = 'valid' ;$ res [ 'msg' ] = 'フォームに正しく記入されています' ;}その他 {$ res [ 'type' ] = 'error' ;$ res [ 'msg' ] = 'エラー!' ;}echo json_encode ( $ res ) ;}}?>
モデル/ asyncform.php
<?phpjimport ( 'joomla.application.component.model' ) ;クラス AsyncformModel は JModelを拡張します{}?>
ビュー/デフォルト/ view.html.php
<?phpjimport ( 'joomla.application.component.view' ) ;クラス AsyncformView は JViewを拡張します {パブリック $メッセージ ;関数 __construct ( ) {$ this- > addTemplatePath ( JPATH_COMPONENT。DS 。 ' views'。DS 。 ' default'。DS 。 ' tmpl ' ) ;}関数表示( $ tpl = null ) {// JHTML :: _( 'behavior.mootools');$ document = & JFactory :: getDocument ( ) ;$ document- > addStyleSheet ( 'components / com_asyncform / asset / css / common.css' ) ;$ document- > addScript ( 'components / com_asyncform /assets/js/mootools-1.2.1-core.js' ) ;$ document- > addScript ( 'components / com_asyncform /assets/js/common.js' ) ;親 :: 表示 ( $ tpl ) ;}}?>
ビュー/ default / tmpl / default.php
<?php defined ( '_JEXEC' )またはdie ( 'Access denied' ) ; ?><div id = "log"> </ div><form id = "frm_asyncform" action = "index.php?option = com_asyncform&task = check&format = raw" method = "post"><表><tr><td>名前</ td><td> <input type = "text" name = "name" id = "name" /> </ td></ tr><tr><td>メール</ td><td> <input type = "text" name = "email" id = "email" /> </ td></ tr></ table><input type = "submit" name = "btn_submit" id = "btn_submit" value = "Submit" /></ form>
アセット/ css / common.css
.error {border : 2px solid #ff0000 ;}#log {パディング : 5px ;オーバーフロー : 自動 ;margin-bottom : 5px ;幅 : 452px ;}#log .loaded {背景色 : #ffc0c0 ;}#log .loaded-success {背景色 : #c0ffc0 ;}
アセット/ js / common.js
ウィンドウ。 addEvent ( 'domready' 、 function ( ) {$ ( 'frm_asyncform' ) 。 addEvent ( 'submit' 、 function ( e ) {e。 停止 ( ) ;var log = $ ( 'log' ) 。 空 ( ) ;これ 。 セット ( '送信' 、 {メソッド: 'post' 、onComplete : function ( response ) {var res = JSON。 デコード (応答) ;解像度 アイテム 各 ( 関数 (フィールド) {if (フィールド。 ステータス )$ (フィールド名 ) 。 removeClass ( 'error' ) ;他に$ (フィールド名 ) 。 addClass ( 'error' ) ;} ) ;if ( res。type == 'valid' )ログ。 addClass ( 'loaded-success' ) ;他にログ。 addClass ( 'loaded' ) ;ログ。 set ( 'html' 、 res。msg ) ;}} ) ;これ 。 送信 ( ) ;} ) ;} ) ;
Source: https://habr.com/ru/post/J55788/More articles:Image Composite Editor-パノラマ写真メーカー3名様「地球の時間」に参加しましたか?オープンソースの概要-バグ追跡システム。サイト上の別のリソースから誤ってパスワードを入力した場合はどうしますか?時計の針を1時間進めることを忘れないでくださいSmalltalkを味わう方法Javascript Aから...ロシアではLivejournalへのアクセスがブロックされていますか?ハブラトピコフのビジュアルエディターAll Articles