Changeset 199


Ignore:
Timestamp:
05/25/05 09:14:49 (10 years ago)
Author:
gocher
Message:

plugin form:
changes Form dialog, add Encoding and Target Frame

Location:
trunk/plugins/Forms
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/plugins/Forms/forms.js

    r191 r199  
    8282                this.value = value; 
    8383        } 
     84  function setAttr(el, attr, value) { 
     85    if (value != "") 
     86      el.setAttribute(attr, value); 
     87    else 
     88      el.removeAttribute(attr); 
     89  } 
    8490  var outparam = new Object(); 
    8591  var type = button_id; 
     
    100106      outparam.f_name = frm.name; 
    101107      outparam.f_action = frm.action; 
    102       outparam.f_method = frm.metho; 
     108      outparam.f_method = frm.method; 
     109      outparam.f_enctype = frm.enctype; 
     110      outparam.f_target = frm.target; 
    103111    } else {; 
    104112      outparam.f_name = ""; 
    105113          outparam.f_action = ""; 
    106             outparam.f_method = "";   
     114            outparam.f_method = ""; 
     115      outparam.f_enctype = ""; 
     116      outparam.f_target = ""; 
    107117    } 
    108118        editor._popupDialog("plugin://Forms/form", function(param) { 
     
    110120                        if(frm) { 
    111121                            frm.name     = param["f_name"]; 
    112                                   frm.action = param["f_action"]; 
    113                                   frm.method = param["f_method"]; 
     122          setAttr(frm, "action", param["f_action"]); 
     123          setAttr(frm, "method", param["f_method"]); 
     124          setAttr(frm, "enctype",param["f_enctype"]); 
     125          setAttr(frm, "target", param["f_target"]); 
    114126                    } else { 
    115                             editor.surroundHTML('<form name="' + param["f_name"] + '"' + 
    116                                    ' action="' + param["f_action"] + '"' + 
    117                                                      ' method="' + param["f_method"] + '">', 
    118                               '&nbsp;</form>'); 
     127          frm = '<form name="' + param["f_name"] + '"'; 
     128          if (param["f_action"] != "") frm += ' action="' + param["f_action"] + '"'; 
     129                                  if (param["f_method"] != "") frm += ' method="' + param["f_method"] + '"'; 
     130          if (param["f_enctype"] != "") frm += ' enctype="' + param["f_enctype"] + '"'; 
     131          if (param["f_target"] != "") frm += ' target="' + param["f_target"] + '"'; 
     132          frm += '>'; 
     133                            editor.surroundHTML(frm, '&nbsp;</form>'); 
    119134        } 
    120135      } 
  • trunk/plugins/Forms/popups/form.html

    r191 r199  
    1515  document.getElementById("f_action").value = param.f_action; 
    1616  document.getElementById("f_method").value = param.f_method; 
     17  document.getElementById("f_enctype").value = param.f_enctype; 
     18  document.getElementById("f_target").value = param.f_target; 
    1719        document.getElementById("f_name").focus(); 
    1820}; 
     
    3133  } 
    3234  // pass data back to the calling window 
    33   var fields = ["f_name", "f_action", "f_method"]; 
     35  var fields = ["f_name", "f_action", "f_method", "f_enctype", "f_target"]; 
    3436  var param = new Object(); 
    3537  for (var i in fields) { 
     
    5961  <legend>Form handler script</legend> 
    6062  <div class="space"></div> 
    61   <div class="fr">Script URL:</div> 
     63  <div class="fr">Action URL:</div> 
    6264  <input name="action" id="f_action" type="text" size="30"> 
    6365  <p /> 
     
    6971  </select> 
    7072  <div class="space"></div> 
     73  <div class="fr">Encoding:</div> 
     74  <select name="enctype" id="f_enctype"> 
     75    <option value=""></option> 
     76    <option value="application/x-www-form-urlencoded">HTML-Form to CGI (default)</option> 
     77    <option value="multipart/form-data">multipart Form Data (File-Upload)</option> 
     78  </select> 
     79  <p /> 
     80  <div class="fr">Target Frame:</div> 
     81  <input name="target" id="f_target" type="text" size="30"> 
     82  <p />   
    7183  </fieldset> 
    7284 
Note: See TracChangeset for help on using the changeset viewer.