validation code needed - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: validation code needed (/Thread-validation-code-needed) |
validation code needed - nats - 06-02-2012 Hi, I have a web edit text box which should not accept ^ and ~.Also the minimum characters that it should accept should be 3. It should accept all alphanumeric characters except ^ and ~. Please provide me the code for this in QTP. RE: validation code needed - supputuri - 06-02-2012 Check if this is useful. Code: NegativeTest Dialog("Login").WinEdit("Agent Name:"),"^" RE: validation code needed - nats - 06-02-2012 Thankx for the reply. Just wantd to know if it can be solved using regular expressions? Also,this text box should not allow strings such as anita^,~rohan. Does the above code run successfuly for these examples too.? RE: validation code needed - supputuri - 06-02-2012 Hi Nats, Yes we can handle this using Regular expression too. You have to create a regular expression object and then create a pattern such that it will exclude the characters (~,^). Yeah Script which I have provided will work for anita^,~rohan by using the instr function rather than doing direct validation for the characters. please find the below updated code. Code: NegativeTest Dialog("Login").WinEdit("Agent Name:"),"ani~ta" RE: validation code needed - nats - 06-16-2012 Hey thanx a llot!! RE: validation code needed - Ankur - 06-16-2012 @nats: Please make sure to read the posting guidelines and post on appropriate sub-forum. |