Micro Focus QTP (UFT) Forums
Condition if used to check set values in text box(simple one here) - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Condition if used to check set values in text box(simple one here) (/Thread-Condition-if-used-to-check-set-values-in-text-box-simple-one-here)



Condition if used to check set values in text box(simple one here) - swapna_2008 - 02-26-2008

Code:
window("Flight Reservation").Dialog("Open Order").Winedit("Edit").Set "swapna"

The above statement would set the text feild with swapna

Clarification:I want to check all the conditions in the like:
If the text box is null or if it has numerics ......then it should not aloow
i am using
1)for example:if i have to check text box is empty i used. I jus tried this.not working
Code:
if window("Flight Reservation").Dialog("Open Order").Winedit("Edit").Set ""="" then
statements........
end if

2) when i use the key word exsists
Code:
if window("Flight Reservation").Dialog("Open Order").exsits then
statements........
else
ststements
end if


Regards
Swapna


RE: Condition if used to check set values in text box(simple one here) - deepakmehta82 - 02-27-2008

Hi Swapna,
You want to check that whether the text box is null or if it has numerics.
Now, if you want to check it afterwards then it means after entering the values in the text box.Then, you can do so after taking the output values in a variable and then checking whether it is NULL or numeric
BUT if you want to check before entering any value in the text box like a validation that it should not allow blank or numeric.Then you can do that by getting the ROProperty of any property's value and matching it with the required data.
Here,you give the right choice for which the text box should accept the value and rest all cases will fail.I mean you cannot bifurcate the invalid cases,you just have one right and rest wrong.
Example-
Suppose I want username to be "Deepak" and I entered "abc" as username.So,this is how you can check:

Code:
Browser("orkut - login").Page("orkut - login").WebEdit("Email").Set "abc"
username=Browser("orkut - login").Page("orkut - login").WebEdit("Email").GetROProperty("value")'
If username="deepak" Then
   Reporter.ReportEvent  micPass, "username" ,  "pass"
  
  Browser("orkut - login").Page("orkut - login").WebEdit("Passwd").SetSecure "34723fh445346hgjhghfgh35dghdhjfhfk"

  Browser("orkut - login").Page("orkut - login").WebButton("Sign in").Click
  
  else
  
   Reporter.ReportEvent  micFail, "username" , "fail"
  exittest()
End If



RE: Condition if used to check set values in text box(simple one here) - swapna_2008 - 03-04-2008

Hi deepak
The above is fine ,n thank u for tht

But i jus wanna knoe in genral how to validate a text box with different conditions

like if (srting)
If (special chracters).
If (Blank space)
and also wrt date how to chk if its a valid date


regards
Swapna