Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
mjg2xw Frequent Contributor.
Frequent Contributor.

How to use "Event = onkeypress" in a form


I'm having a form called "AutorisationsID" of "Control Type" = Text, in that I have a Event = onkeypress, that when the form is filled with a valut, I need to set other  from call "DigitalSignature" to 'true', and when the text is cleard/removed the form "DigitalSignature" have to be set to 'false'


1.) - I have to type at minimum of 2 characters before the statement "if (AutorisationsID.length>"0")" is TRUE

2.) - The "backspace" / "Delete" on the text in the form is not getting triggered, so I never gets the "DigitalSignature" set to 'false'


Ecma script in the form.....

AutorisationsID = field.getValue();

if ((AutorisationsID!=null)&&(AutorisationsID!=undefined)&&(AutorisationsID!=""))
if (AutorisationsID.length>"0")
form.showMsg("IF - Value of AutorisationsID = : " + AutorisationsID);
form.showMsg("IF - Length ofAutorisationsID = : " + AutorisationsID.length);
form.setValues("DigitalSignature", 'true')
form.showMsg("ELSE - Value of AutorisationsID = : " + AutorisationsID);
form.showMsg("ELSE - AutorisationsID = : " + AutorisationsID.length);
form.setValues("DigitalSignature", 'false')

Thanks in advanced


Labels (1)
1 Reply
mjg2xw Frequent Contributor.
Frequent Contributor.

Re: How to use "Event = onkeypress" in a form

Some more info.
From -> https://www.w3schools.com/jsref/event_onkeypress.asp
is seems that "backspase/Delete" keybord tapping is not supporten. The Site suggest using oninput or onkeydown, but thus event is not supported
Any other ides??

N B. Running IDM 4.7.3 AE
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.