271
Views
6
Comments
Solved
How to use javascript to get the value - Outsystems11

I hava a input

I want to get this value,but i not do it

So,I use the javascript for this

"

var inputElement = document.getElementsByName('Input_Company7');

if(inputElement.length > 0)

{    var a = inputElement[0];    

window.alert(a);}

else{    

window.alert("length="+inputElement.length)}

"


It alerts "leagth=0"


How i can do to get value?

Help me,thanks!  


2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi Hora,

The platform automatically assigns generated ids for every OutSystems widget that has its Name property assigned.

You can get the Id automatically generated by OutSystems at runtime and inject it in your JavaScript code, as input parameter.

So add to your Javascript node, an input parameter called WidgetId and set its value in your action to Input_Textvar3.Id.

Regards,

Daniel

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

ps. to validate the length of the Input widget, you don't even need to use JavaScript. As you have set the mandatory attribute on the input widget, the widget state will be invalid if it isn't filled. The Input_TextVar3.Valid property will be false.

For more info see:
https://success.outsystems.com/documentation/10/developing_an_application/design_ui/forms/validate_form_inputs/


UserImage.jpg
Hora susuki
UserImage.jpg
Puja Rani
Solution


Hi @Hora susuki ,

As correctly mentioned by Daniel, you can directly pass the automatically generated Id for the input widget as an input to your javascript . This will give you the value. Hope this helps!.


UserImage.jpg
Hora susuki

You help me .Thank you very much

UserImage.jpg
Puja Rani

If you think this solution helped and working fine, you can mark it as Solved.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP
Solution

Hi Hora,

The platform automatically assigns generated ids for every OutSystems widget that has its Name property assigned.

You can get the Id automatically generated by OutSystems at runtime and inject it in your JavaScript code, as input parameter.

So add to your Javascript node, an input parameter called WidgetId and set its value in your action to Input_Textvar3.Id.

Regards,

Daniel

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

ps. to validate the length of the Input widget, you don't even need to use JavaScript. As you have set the mandatory attribute on the input widget, the widget state will be invalid if it isn't filled. The Input_TextVar3.Valid property will be false.

For more info see:
https://success.outsystems.com/documentation/10/developing_an_application/design_ui/forms/validate_form_inputs/


UserImage.jpg
Hora susuki
UserImage.jpg
Puja Rani
Solution


Hi @Hora susuki ,

As correctly mentioned by Daniel, you can directly pass the automatically generated Id for the input widget as an input to your javascript . This will give you the value. Hope this helps!.


UserImage.jpg
Hora susuki

You help me .Thank you very much

UserImage.jpg
Puja Rani

If you think this solution helped and working fine, you can mark it as Solved.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.