in my setup I need some user input. Of course these have to be checked. That works quite well with your "Input validation expression" option.
If the input is valid the Setup is going to the next step as excepted
If the input is not valid, you write that i should display an error message. Since there is no option for error messages on user input I have created one myself with JOptionPane. This also works well, but it jumps every time in the error message - No matter if "next" or "back" is clicked. can not even click cancel without jump into the error screen.
Is there a other way to display the error message? or how do I leave the screen appear only when click on next?
You cannot leave the text field if the input validation returns false.
Another option is to validate the value in the "Validation expression" script of the screen. You can access the value of the text field via its bound variable there:
String variableValue = context.getVariable("variableName");
For error messages, it is recommend to use
Util.showErrorMessage("error message");
Related
The field only permits the user to set data if the blinking cursor appears in text area prior to entering data.
I tried to activate JavaWindow, SetFocus on JavaEdit to get cursor blink. Didn't work. Here is the code I've tried:
JavaWindow("ABC").Activate
JavaWindow("ABC").JavaEdit("XYZ").SetFocus
JavaWindow("ABC").JavaEdit("XYZ").Set "Hello"
' UFT recorded script to get blink and enter data as follows. This doesn't work during execution.
JavaWindow("ABC").JavaEdit("XYZ").SetCaretPos 0,0
JavaWindow("ABC").JavaEdit("XYZ").Set "Hello"
What is the handle name to be used while calling createcaret, in case i need to create one before using SetCaretPos.
Will try sendkeys now. Any other ideas are to get focus on JavaEdit are welcome.
Instead of setting up 3 TextFields on a Stage that collect first, second and last names, I'd like to have just one in which a user can enter all his/ her names. I think my form will look simpler, less clustered, therefore less complicated for my users.
I was on some web page some time back and saw an implementation of the above this way:
The text field when blank shows three parts hinting first, second and
last name. When initially on forcus, only the first name hint
dissapeared, but the others, second and last remained. Then when
you're done entering the first name and press spacebar, the second
name dissapears and now only the last name hint shows. The same will
go for last name after entering the second name.
All text dissapears when the hint is set as new TextField("hint");.
Is there a way to go about it without having all the hints dissapear on focus?
Thank you all in advance.
I am facing an issue with Selenium SendKeys. I created a separate method in Java for sending the details to be filled in for a window using Sendkeys. During first attempt it enters all the configured details and was working fine.
I use the same method after few lines in my code for entering another set of details. But this time it fails to enter the details in window. I can see selenium entering the text and switching to the next tabs, but the text is not visible. I don't see any exception as well.
Can someone please help me with this. Also I am using selenium web driver with IE9.
Thank you,
Raj
Try Using driver.findElement(By.id("element")).clear(); before sending SendKeys
You are saying it is Entering the text and Switching to Next Tab , IS it entering the Expected values ??? which Text is Not Visible ? the Entered one ? if No Exception - the AUT is Designed to Hide the Second entered Text ?
Provide snippets of Code to Check whats happening with the driver
I'm designing a program simulating a vending machine. You know how vending machines have that one large text box that displays whatever messages you need to know...that's what I want to do. So basically, if the user clicks a button and if the item is out of store, expired, they don't have enough credit, whatever, the message should be displayed in this box.
Then, after a second or 2, return to displaying how much money the user put into the machine. I also want to make the box so that, well theres a button next to the text box to click to insert money. When they click that, I want to make the text box editable, they then enter the amount of money they want to enter, then press insert again, and the money is inserted. The text box becomes uneditable again, and displays the credit they have in the machine.
Does anyone have any suggestions as to how to do this?
I also was wondering how I could implement the delay before getting rid of the message and returning to displaying the credit in the machine. Thank you.
As Andrew Thompson says, you would use a JTextField. Set the desired text using the setText() method and you could then use a sleep function (usleep() I think should work for your application) and then set the text again back to the Dollar value.
Edit: didn't see the last half. To enable and disable the textfield entirely, use setEnabled(true/false), to stop it from being editable, use setEditable(true/false)
Also, just thinking, you could get the current date in a timestamp format and then enter a loop where you continually get the timestamp and compare it to the first one. If the desired difference is reached then exit the loop and update the textfield. Have a look at the Java doc for Date ;)
I have a requirement where clicking each errors should focus input box. I am trying different ways but could not succeed. I got some answers in the past but that did not work like i wanted.
I was using tag with onclick event but I had to do this for each input boxes which is not so relevant if I have 20 fields. So I was looking some thing dynamic .for eg: .
Its has been a long I am looking for this solution. Any kind of help or suggestions would be highly appreciated.
Can you consider this -> Instead of showing all the error messages on top, you can show the error message along with the input box which is related to this input box. The h:message have a attribute for which you can use.
Other option would be developing custom renderer which will output onclick event for each error message. The error message have the component id so you can use that id to set the focus in javascript. This will be all dynamic.
Here is some information about implementing custom renderer http://java.sun.com/javaee/javaserverfaces/reference/docs/customRenderKit.html