java ee - JavaScript force an OnChange in Maximo -


i'm working on bookmarklet maximo, java ee application, , need populate few input boxes.

generally when use inputs data box click button gives them popup , search value added script. or can type name , hit tab/enter , turns capital letters , few things in background (not sure exactly).

i use

javascript: $('mx1354').value = "khbrarr"; $('mx1354').ov= "khbrarr"; 

but not work need to. set's input box value needed, doesn't run background functions when hit save button doesn't recognize changes , discards put box.

how simulate tab/enter button has been pressed?

so far i've tried call onchange, focus/blur, , click functions (not 100% sure if called them correctly).

the dojo library part of application, i'm not sure if can use 1 if it's feature or if jquery cause conflict.

p.s. needs run in ie.

the onchange function:

function tb_(event) {     event = (event) ? event : ((window.event) ? window.event : "");     if(designmode)         return;     var ro = this.readonly;     var exc=(this.getattribute("exc")=="1");     switch(event.type)     {         case "mousedown":             if(getfocusid()==this.id)                 this.setattribute("stoptcclick","true");             break;         case "mouseup":             if (isie() && !hasfocus(this))              {                 this.focus();             }             if (isbidienabled)              {                 adjustcaret(event, this); // bidi-hcg-as             }             break;         case "blur":             input_onblur(event,this);             if (isbidienabled)                                      // bidi-hcg-sc                 input_bidi_onblur(event, this);             break;         case "change":             if(!ro)                 input_changed(event,this);             break;         case "click":             if(overerror(event,this))                 showfielderror(event,this,true);             var liclick=this.getattribute("liclick");             var li=this.getattribute("li");             if(li!="" && liclick=="1")             {                 frontendevent(getelement(li),'click');             }              if(this.getattribute("stoptcclick")=="true")             {                 event.cancelbubble=true;             }             this.setattribute("stoptcclick","false");             break;         case "focus":             input_onfocus(event,this);             if (isbidienabled)                      // bidi-hcg-sc                 input_bidi_onfocus(event, this);             this.select();             break;         case "keydown":             this.setattribute("keydown","true");             if(!ro)             {                 if(isbidienabled)                     processbackspacedelete(event,this); // bidi-hcg-as                 if(haskeycode(event, 'keycode_delete') || haskeycode(event, 'keycode_backspace'))                 {                     gethiddenform().elements.nameditem("changedcomponentvalue").value = this.value;                                      }                 if((haskeycode(event, 'keycode_tab') || haskeycode(event, 'keycode_esc')))                 {                     var tamatch = dojo.attr(this, "ta_match");                     if(tamatch) {                         if(tamatch.tolowercase().indexof(this.value.tolowercase()) == 0)                          {                             console.log("tamatch="+tamatch);                             this.value = tamatch;                             input_keydown(event, this);                             dojo.attr(this, {"prekeyvalue" : ""});                             input_forcechanged(this);                             inputchanged = false;                             return; // don't want input_keydown again prekeyvalue work                         }                     }                     if(this.getattribute("popuptype"))                     {                         var popup = dijit.byid(dojohelper.getpopupid(this));                         if (popup)                         {                             dojohelper.closepickerpopup(popup);                             if(haskeycode(event, 'keycode_esc'))                             {                                 if (event.preventdefault)                                 {                                       event.preventdefault();                                   }                                 else                                 {                                       event.returnvalue  = false;                                   }                                    return;                             }                         }                     }                 }                 input_keydown(event,this);                 datespin(event,this);             }             else if(haskeycode(event,'keycode_enter') || (haskeycode(event,'keycode_down_arrow') && this.getattribute("liclick")))             {                 var lbid = this.getattribute("li");                 frontendevent(getelement(lbid), 'click');             }             else if(haskeycode(event,keycode_backspace))             {                 event.cancelbubble=true;                 event.returnvalue=false;             }             break;         case "keypress":             if(!ro)             {                 if(event.ctrlkey==false && haskeycode(event,'keycode_enter'))                 {                     var db = this.getattribute("db");                     if(db!="")                     {                         sendclick(db);                     }                 }             }             break;         case "keyup":             var keydown = this.getattribute("keydown");             this.setattribute("keydown","false");             if(event.ctrlkey && haskeycode(event,'keycode_spacebar'))             {                 if(showfielderror(event,this,true))                 {                     return;                 }                 else                 {                     menus.typeahead(this,0);                 }             }             if(!ro)             {                 if(isbidienabled)                     processbidikeys(event,this); // bidi-hcg-as                  numericcheck(event,this);                    var min = this.getattribute("min");                 var max = this.getattribute("max");                  if(min && max && min!="none" || max!="none")                 {                     if(min!="none" && parseint(this.value)<parseint(min))                     {                         this.value=min;                         gethiddenform().elements.nameditem("changedcomponentvalue").value = this.value;                                              this.select();                         return false;                     }                      if(max!="none" && parseint(this.value)>parseint(max))                     {                         this.value=max;                         gethiddenform().elements.nameditem("changedcomponentvalue").value = this.value;                         this.select();                         return false;                     }                 }                 var defaultbutton = false;                 if(event.ctrlkey==false && haskeycode(event,'keycode_enter'))                 {                     var db = this.getattribute("db");                     if(db!="")                     {                         defaultbutton=true;                     }                 }                 input_changed(event,this);                               }             else             {                 setfocusid(event,this);             }             if(showfieldhelp(event, this))             {                 return;             }             if(keydown=="true" && haskeycode(event, 'keycode_enter') && !event.ctrlkey && !event.altkey)             {                 menus.typeahead(this,0);                 return;             }             if(!haskeycode(event, 'keycode_enter|keycode_shift|keycode_ctrl|keycode_esc|keycode_alt|keycode_tab|keycode_end|keycode_home|keycode_right_arrow|keycode_left_arrow')                     && !event.ctrlkey && !event.altkey)             {                 menus.typeahead(this,0);             }             break;         case "mousemove":             overerror(event,this);             break;         case "cut":         case "paste":             if(!ro)             {                 var fldinfo = this.getattribute("fldinfo");                 if(fldinfo)                 {                     fldinfo = dojo.fromjson(fldinfo);                     if(!fldinfo.query || fldinfo.query!=true)                     {                         setbuttonenabled(savebutton,true);                     }                 }                 window.settimeout("inputchanged=true;input_forcechanged(dojo.byid('"+this.id+"'));", 20);             }             break;     } } 

after time found in order make change page via javascript need submit hidden form can verify on back-end.

here code used change value of input fields.

        cc : function(e,v){             e.focus(); //get focus of element             e.value = v; //change value             e.onchange(); //call onchange event             e.blur(); //unfocus element             console.log("title === "+e.title);             if(e.title.indexof(v) != -1) {                 return true; //the value partially matches requested value. no need update             } else {                 //generate hidden form , submit update page new value                 var hiddenform = gethiddenform();                 var inputs = hiddenform.elements;                 inputs.nameditem("changedcomponentid").value = e.id;                 inputs.nameditem("changedcomponentvalue").value = v;                 inputs.nameditem("event").value = "x"; //send dummy event script see's invalid , sets right event                 submithidden();             }             //value isn't set required value pass false             return false;         } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -