Overriding InlineEditBox

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Overriding InlineEditBox

Harry Devine
I'd like to override InlineEditBox to have the user enter their log in credentials when the change a field in their profile.  The field is being edited by an InlineEditBox.  I figure that I need to override InlineEditBox so I can override the save function, do my validation, and continue from there.  Here's what I'm trying (any pointers would be greatly appreciated):

], function(declare, request, Deferred, on, dom, query, registry, InlineEditBox) {
  return declare("TSInlineEditBox", InlineEditBox, {

  /* Handler for the Change Password Cancel button */
  query("#pwdDialogSubmit").forEach(function(node) {
    on(node, "click", function() {
      this.verifyUser(mod.iebPhone.get("value"), data.phone);

  onChange: function() {
    dom.byId("pwdDialogUserName").innerHTML = "<b>" + registry.byId("username").get("value") + "</b>";

  /* This is the overridden save function. We want to see if this user */
  /* passes the password validation check BEFORE we save the edit. If */
  /* they do, we will save the edit; if not, we will cancel it. */ 
  save: function(focus) {

  var result = false;


  /* Not sure what to do here!!! */


  /* This function is called when the user clicks the Unlock Account button. */
  verifyUser: function(phone, oldPhone) {
    request.post("verifyUser.php", {
      handleAs: "json",
      data: {'user': registry.byId("username").get("value"),
      'pwd': registry.byId("pwdDialogPassword").get("value"),
      'phone': phone
    }).then (function(data){
      if (data.status == "true") {
        dom.byId("ldapAccountUnlockStatus").innerHTML = "<b><font face=Arial color=green>Password verified; Phone update recorded!";
        setTimeout(function() {dom.byId("ldapAccountUnlockStatus").innerHTML = "";}, 3000);
      else {
        dom.byId("ldapAccountUnlockStatus").innerHTML = "<b><font face=Arial color=red>Password failed! Phone update aborted!</font></b>";
        setTimeout(function() {dom.byId("ldapAccountUnlockStatus").innerHTML = "";}, 3000);


What I need to do, in a nutshell, is:

1) The user double-clicks the field and makes their update;

2) User clicks Save;

3) Dialog is presented to enter their LDAP credentials;

4) Credentials are checked;

5) If the credentials are correct, the update is saved as normal;

6) If the credentials are incorrect, the update is NOT saved and the data reverts back to the previous value;

Thanks for any help!


Dojo Toolkit: http://dojotoolkit.org/
Tutorials: http://dojotoolkit.org/documentation/

[hidden email]
To unsubscribe, visit: http://mail.dojotoolkit.org/mailman/listinfo/dojo-interest