Additional Blogs by SAP
cancel
Showing results for 
Search instead for 
Did you mean: 
craigcmehil
Community Manager
Community Manager
0 Kudos

Recently I've come across the topic of text input validating and well there are the many built in solutions with HTMLB elements and PHTMLB items as well however I wanted something a bit different.


Well I began searching for a way to do it, and I came across MREDKJ's Tutorials , and they had a great "Public Domain" script available and so I figured I'd give it a shot and see if it would work for me.








Well this did the trick, this is what I wanted. This enabled me to select a field and only allow letter input in the field without an alertbox or processing and validating first.



Ok, not exactly what I wanted; I wanted basically like the doValidate of HTMLB:INPUTFIELD for type INTEGER so with a quick change to the coding, I now had it. Regular Expressions are just marvelous!








Did you catch the change? I removed the ! before reg.test(keyChar).



Now how about getting this to attach itself to my elements?


In my previous craig.cmehil3/blog I stated how I did this, so I won't go into a lot of detail and instead just show the code.

<!--

function emailCheck(field,msg){

       if (field.value != "") {

           var reg = /^()@(().)()$/;

             if (!reg.test(field.value)) {

          alert(msg);

          return false;

         }

       }

}

//-->

4 Comments