Show/hide a widget on lost focus of a text field

newbie-question

#1

I am beginner in learning Axure, so my question may be very silly to you :slight_smile:

My requirement: Also please check the attached sample RP file.
I have a text field with some value, when I change the existing text and on lost focus of the field then I need to show a label (which is hidden) and the label should show the changed text of the text field.
Lostfocus.rp (49.6 KB)

If text is not changed on text field and lost focus the label should not be visible.

Can you please help me.


#2

If text not changed will be this β€œβ€


#3

@jamesorior If text is not changed then the label will not be visible at all.


#4

@sreenivas
I have updated you file. OnTextChanged, say the content of you text field to field to a variable, in this case i used the globalVariable but you can create your own. Then set the text of the invisible text area to the content of the variable. OnLostFocus, hide the text field. This example is simple and should help you understand what needs to be done.
Lostfocus.rp (48.2 KB)


#5

@Pierre01 Thank you for replying. Unable to open the file since I am using Axure 8 version. Can you please save it as Axure 8 compatible and share again?


#6

Version 8

Hope this solution helps

OnPageLoad
Set focus to AuthorizationName_txt
Set text on AuthorizationName_txt equal to β€œVLE_01”
Hide AuthorizationNameResult_lbl

On TextChange
if text on AuthorizationName_txt equals""
Hide AuthorizationNameResult_lbl

Else
Show AuthorizationNameResult_lbl
Set text on AuthorizationNameResult_lbl equal to text on AuthorizationName_txt

OnFocus
if text on AuthorizationName_txt equals β€œβ€ and cursor leave area of AuthorizationName_txt
Show AuthorizationNameResult_lbl
Set text on AuthorizationNameResult_lbl equal to text on AuthorizationName_txt

Else if cursor enter area of AuthorizationName_txt
Show AuthorizationNameResult_lbl
Set text on AuthorizationNameResult_lbl equal to text on AuthorizationName_txt

OnLostFocus
if text on AuthorizationName_txt does not equal"" and cursor enters area of AuthorizationName_txt
Hide AuthorizationNameResult_lbl
Set text on AuthorizationNameResult_lbl equal to text on AuthorizationName_txt

Else if text on AuthorizationName_txt equal text AuthorizationNameResult_lbl and cursor leaves area of AuthorizationName_txt
Hide AuthorizationNameResult_lbl
Set text on AuthorizationNameResult_lbl equal to text on AuthorizationName_txtLostfocus.rp (59.3 KB)


#7

That’s awesome thanks for helping.