Changeset 23136


Ignore:
Timestamp:
2013/08/27 17:38:18 (7 years ago)
Author:
pineray
Message:

#2342 JavaScript?のグローバルな宣言を減らす
form2のID指定漏れ。
フォーム送信関数の変更。

Location:
branches/version-2_13-dev
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/Smarty/templates/admin/design/template.tpl

    r23134 r23136  
    8484    </div> 
    8585</form> 
    86 <form name="form2" method="post" action="?"> 
     86<form name="form2" id="form2" method="post" action="?"> 
    8787    <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
    8888    <input type="hidden" name="mode" value="" /> 
  • branches/version-2_13-dev/html/js/eccube.js

    r23135 r23136  
    160160 
    161161    eccube.fnFormModeSubmit = function(form, mode, keyname, keyid) { 
    162         var formElement = $("form#" + form); 
    163162        switch(mode) { 
    164163            case 'delete': 
     
    180179                break; 
    181180        } 
    182         formElement.find("input[name='mode']").val(mode); 
     181        var values = {mode:mode}; 
    183182        if(keyname !== undefined && keyname !== "" && keyid !== undefined && keyid !== "") { 
    184             formElement.find("*[name=" + keyname + "]").val(keyid); 
    185         } 
    186         formElement.submit(); 
     183            values[keyname] = keyid; 
     184        } 
     185        eccube.submitForm(values, form); 
    187186    }; 
    188187 
     
    227226    }; 
    228227 
    229     eccube.submitForm = function(form){ 
    230         if (typeof form === 'undefined') { 
    231             form = eccube.defaults.formId; 
    232         } 
    233         $("form#" + form).submit(); 
     228    eccube.submitForm = function(values, form){ 
     229        var formElement; 
     230        if (form !== undefined && typeof form === "string" && form !== "") { 
     231            formElement = $("form#" + form); 
     232        } else if (form !== undefined && typeof form === "object") { 
     233            formElement = form; 
     234        } else { 
     235            formElement = $("form#" + eccube.defaults.formId); 
     236        } 
     237        if (values !== undefined && typeof values === "object") { 
     238            $.each(values, function(index, value) { 
     239                formElement.find("input,select").filter("[name='" + index + "']").val(value); 
     240            }); 
     241        } 
     242        formElement.submit(); 
    234243    }; 
    235244 
Note: See TracChangeset for help on using the changeset viewer.