[Cartoweb-dev] [Bug 1528] Edit Plugin: support boolean type with checkbox

bugzilla-daemon at bugzilla.maptools.org bugzilla-daemon at bugzilla.maptools.org
Fri Jul 21 09:36:24 EDT 2006


http://bugzilla.maptools.org/show_bug.cgi?id=1528





------- Additional Comments From bartvde at xs4all.nl  2006-07-21 09:36 -------
Changes necessary to dhtmlEdit.js (maybe this could be done better though since
there is quite some code replication now, but for checkbox we need to use
onClick instead of onKeyPress):

    // editable field
    if (this.editAttributeTypes[i] == 'string' || this.editAttributeTypes[i] ==
'boolean' || this.editAttributeTypes[i] == 'integer') {
      if (typeof aFeature.attributes != "undefined")
        var value = aFeature.attributes[i];
      else var value = '';
      if (this.editAttributeTypes[i] == 'boolean')
      {
        var input_hidden = createInput(td,
          "edit_feature_" + aFeature.id + "[" + this.editAttributeNames[i] +
"]", value, 'hidden');
        var input_bool = createInput(td,
          "bool_edit_feature_" + aFeature.id + "[" + this.editAttributeNames[i]
+ "]", value, 'checkbox');
        input_bool.checked = (value == 't');
        input_bool.onclick = function()
        {
          if (input_bool.checked) { input_hidden.value = 't'; } else {
input_hidden.value = 'f'; }
          if (!this.changed) {
            if (aFeature.operation != 'insert')
              setFeatureOperation(aFeature, "update");
            var validate = xGetElementById('validate_all');
            validate.className = "form_button_hilight";
            if (editDisplayAction != 'folder'){
              var validate = xGetElementById('validate2');
              validate.className = "form_button_hilight";
            }
          }
          this.changed = true;
        }
      }
      else
      {
        var input = createInput(td,
          "edit_feature_" + aFeature.id + "[" + this.editAttributeNames[i] +
"]", value, 'text');
        input.onkeypress = function() {
          if (!this.changed) {
            if (aFeature.operation != 'insert')
              setFeatureOperation(aFeature, "update");
            var validate = xGetElementById('validate_all');
            validate.className = "form_button_hilight";
            if (editDisplayAction != 'folder'){
              var validate = xGetElementById('validate2');
              validate.className = "form_button_hilight";
            }
          }
          this.changed = true;
        }
      }
    }
    // not editable field




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


Please do NOT reply to this email, use the link above instead to 
login to bugzilla and submit your comment. Any email reply to this
address will be lost.


More information about the Cartoweb-dev mailing list