Ignore:
Timestamp:
2009/10/30 19:40:52 (14 years ago)
Author:
satou
Message:

#561 住所検索の非ポップアップ化(jQuery×AJAX)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/class/pages/LC_Page_InputZip.php

    r18355 r18357  
    5959        // 入力エラーの場合は終了 
    6060        if(count($arrErr) > 0) { 
    61             $this->tpl_start = "window.close();"; 
    62             SC_Utils::sfDispSiteError(CUSTOMER_ERROR); 
     61            $tpl_message = ""; 
     62            foreach($arrErr as $key => $val) { 
     63                $tpl_message .= preg_replace("/<br \/>/", "\n", $val); 
     64            } 
     65            echo $tpl_message; 
     66         
     67        // エラー無し 
     68        } else { 
     69            // 郵便番号検索文作成 
     70            $zipcode = $_GET['zip1'].$_GET['zip2']; 
     71            $zipcode = mb_convert_kana($zipcode ,"n"); 
     72 
     73            // 郵便番号検索 
     74            $data_list = SC_Utils_Ex::sfGetAddress($zipcode); 
     75 
     76            // 郵便番号が発見された場合 
     77            if(!empty($data_list)) { 
     78                $data = $data_list[0]['state']. "|". $data_list[0]['city']. "|". $data_list[0]['town']; 
     79                echo $data; 
     80 
     81            // 該当無し 
     82            } else { 
     83                echo "該当する住所が見つかりませんでした。"; 
     84            } 
    6385        } 
    64  
    65         // 郵便番号検索文作成 
    66         $zipcode = $_GET['zip1'].$_GET['zip2']; 
    67  
    68         $data_list = SC_Utils_Ex::sfGetAddress($zipcode); 
    69  
    70         // 郵便番号が発見された場合 
    71         if(!empty($data_list)) { 
    72             $this->tpl_state = $data_list[0]['state']; 
    73             $this->tpl_city = $data_list[0]['city']; 
    74             $this->tpl_town = $data_list[0]['town']; 
    75  
    76             $func = "fnPutAddress('" . $_GET['input1'] . "','" . $_GET['input2']. "');"; 
    77             $this->tpl_onload = "$func"; 
    78             $this->tpl_start = "window.close();"; 
    79         } else { 
    80             $this->tpl_message = "該当する住所が見つかりませんでした。"; 
    81         } 
    82  
    83         /* ページの表示 */ 
    84         $objView->assignobj($this); 
    85         $objView->display("input_zip.tpl"); 
    8686    } 
    8787 
     
    9797 
    9898    /* 入力エラーのチェック */ 
    99     function fnErrorCheck() { 
     99    function fnErrorCheck($array) { 
    100100        // エラーメッセージ配列の初期化 
    101101        $objErr = new SC_CheckError($array); 
    102102 
    103103        // 郵便番号 
    104         $objErr->doFunc( array("郵便番号1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK" ) ); 
    105         $objErr->doFunc( array("郵便番号2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK" ) ); 
     104        $objErr->doFunc( array("郵便番号1",'zip1',ZIP01_LEN ) ,array( "NUM_COUNT_CHECK", "NUM_CHECK" ) ); 
     105        $objErr->doFunc( array("郵便番号2",'zip2',ZIP02_LEN ) ,array( "NUM_COUNT_CHECK", "NUM_CHECK" ) ); 
    106106        // 親ウィンドウの戻り値を格納するinputタグのnameのエラーチェック 
    107107        if (!$this->lfInputNameCheck($array['input1'])) { 
     
    114114        return $objErr->arrErr; 
    115115    } 
    116      
    117     /** 
    118  * エラーチェック 
    119  * 
    120  * @param string $value 
    121  * @return エラーなし:true エラー:false 
    122  */ 
     116 
     117    /** 
     118     * エラーチェック 
     119     * 
     120     * @param string $value 
     121     * @return エラーなし:true エラー:false 
     122     */ 
    123123    function lfInputNameCheck($value) { 
    124124        // 半角英数字と_(アンダーバー)以外の文字を使用していたらエラー 
     
    126126            return false; 
    127127        } 
    128          
     128 
    129129        return true; 
    130130    } 
    131  
    132131} 
    133132?> 
Note: See TracChangeset for help on using the changeset viewer.