Hello friends, how are you?
I have two doubts today!
Firstly my Java Script Syntax Below:
"function DAF() {
var data = new Date(),
dia = data.getDate().toString(),
diaF = (dia.length == 1) ? '0'+dia : dia,
mes = (data.getMonth()+1).toString(),
mesF = (mes.length == 1) ? '0'+mes : mes,
anoF = data.getFullYear();
geral = diaF+"/"+mesF+"/"+anoF;
}"
In the line below:
geral = diaF + "/" + mesF + "/" + anoF;
There is a syntax error he doesn't accept "/", could someone help me with this syntax?
I also have a local variable called DataJS in Outsystems
And I would like to know how I can assign the value of my variable geral in JS code
to my Outsystems DataJS local variable.
Grateful for the help! this community is a Success!
Hi Kleber,
Please find the attached .oml solution file
- Set the Input widget style property in the extended properties section
style = "display:none;"
or set a StyleClass with "display:none;" definition
Refer this Forum Post: https://www.outsystems.com/forums/discussion/63166/how-to-bind-the-result-of-javascript-function-in-web-app-to-outsystem-local/#Post247289
"function DAF() { var data = new Date(), dia = data.getDate().toString(), diaF = (dia.length == 1) ? '0'+dia : dia, mes = (data.getMonth()+1).toString(), mesF = (mes.length == 1) ? '0'+mes : mes, anoF = data.getFullYear(); geral = diaF+'/'+mesF+'/'+anoF; return geral; } // assigning date value to the local variable document.getElementById('" + Input_DateValue.Id + "').value = DAF(); "
See the sample app
Hope this helps you!
Regards,
Benjith Sam
Benjith Sam wrote:
My Friend,
I saw hear, if you click twice im the button you receive the FeedBackMessage, If you just click you dont Receive,
I put an Expression and whem i click twice, i receive the FeedBackMessage and the expression receive de data.
Kleber Quilez wrote:
Hi, I also observed the same, sorry I don't know why it is happening so... even though the feedback message is not show at first click still the value is successfully stored in the Local variable but somehow the Feedback message server action is not getting triggered at the first call..!
Calling the JS statement within the expression widget as mentioned in my previous comment would be the relevant implementation which I would recommend for your mentioned Use-case.
Perfect!!! Tks!!
Now I have an Input with the date value, exactly what I wanted. How could I do in preparation to send this value to a Variable? I tried to place an assign after Java RunTime but it didn't work.
Tks!!
For this requirement, you don't need to define the JS, assignment node and the related logic in the preparation action flow; Instead of that, within the Screen Layout Footer Placeholder section --> Introduce an Expression widget and define the below mentioned JS code in-between the <script> </script> tags (set the Expression widget Escape Content Property to No)
"<script> var data = new Date(), dia = data.getDate().toString(), diaF = (dia.length == 1) ? '0'+dia : dia, mes = (data.getMonth()+1).toString(), mesF = (mes.length == 1) ? '0'+mes : mes, anoF = data.getFullYear(); geral = diaF+'/'+mesF+'/'+anoF; document.getElementById('" + Input_Date.Id + "').value = geral; </script>"