bug: you can create a triggers with spaces after a before the name, this bug was fixed, we are removing the spaces after and before the string

This commit is contained in:
Carlos Pacha
2011-03-23 11:20:10 -04:00
parent 33ef5f1fc7
commit 2a9deb2fea

View File

@@ -103,7 +103,10 @@
@#PAGED_TABLE_ID.refresh(); @#PAGED_TABLE_ID.refresh();
} }
} }
//with this function, we are removing the spaces after and before of a string
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g, "");
};
//for trigger no wizard //for trigger no wizard
function triggerSave1(form) function triggerSave1(form)
{ {
@@ -112,10 +115,10 @@
var triUid = getField('TRI_UID').value; var triUid = getField('TRI_UID').value;
} }
if(triUid==''){ if(triUid==''){
var triTitle =getField('TRI_TITLE').value; var triTitle =getField('TRI_TITLE').value.trim();
if(triTitle==''){ if(triTitle==''){
alert(G_STRINGS.ID_REQUIRED_NAME_TRIGGERS);return false; alert(G_STRINGS.ID_REQUIRED_NAME_TRIGGERS);return false;
} }
reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(getField('PRO_UID').value),'POST') ; reqName=ajax_function("../triggers/triggers_Save",'lookforNameTrigger','NAMETRIGGER='+encodeURIComponent(triTitle)+'&proUid='+(getField('PRO_UID').value),'POST') ;
if(!reqName){ if(!reqName){
alert(G_STRINGS.ID_EXIST_TRIGGERS);return false; alert(G_STRINGS.ID_EXIST_TRIGGERS);return false;