11
Views
4
Comments
Solved
How to show(read) textbox value in JavaScript alert in RWA

Hello All,

I am facing issue in one of the scenario, I have one textbox in reactive web application,  i wan to read to read/show that textbox value in JavaScript alert message.  

i have applied multiple JS code but giving error as see in the below snap.

can see in the below image..

1) textbox Input value

2) JavaScript Code

3) Error in the web page

If anyone knows how to fetch/read textbox value in JavaScript the kindly reply..

Thanks,


Rank: #87
Solution

HI,

use this way,

take input parameter as widgetid in javascript  and pass id of textbox/input in this and get value like below


var username=document.getElementById($parameters.WidgetID).value;


alert(username);


Hope this will help you.

Regards

Rahul

mvp_badge
MVP
Rank: #19

Hi JK2020,

What are you trying to achieve? If I wanted to show the value of an input to the user in some sort of message, I don't think I'd need to resort to JavaScript... just use the Message tool and pass it the variable that holds the value I want to display (in this case userName).

If you really need to do it using JavaScript and the alert() method:

  • Add an input parameter to your JS node, with the same data type as the userName screen variable and call it ValueToDisplay
  • in your JavaScript node you simply need to add: alert($parameters.ValueToDisplay);

Hope this helps!

Rank: #7122

Hello  Rahul Sahu  ,  Jorge Martins


Thanks For your replay it is working.




Rank: #87

Cheers.