I am facing one situation where I have to read the placeholder of the date input field. I tried using javascript during onBlur() of the field. It is not working. Can someone share your ideas on this?
Two JS tried inside the onblur() action script:
1.var txt = document.getElementById("$parameters.WidgetId").placeholder;
$parameters.Out1 =placeholder;
2.var placeholder = document.getElementById("$parameters.WidgetId").getAttribute("placeholder");
Both are working fine in normal html but getting error in outsystems like:
Thanks,
Kiruthika
Hi @Kiruthika Balasubramanian,
option 1 can't possibly work, you are setting 'txt', and then referring to 'placeholder'
both can't possibly work, because you have put double quotes around $parameters.WidgetId. This is already a string in and of itself, you putting those quotes there, means it is going to try and find an element in the DOM with the id literally equal to "$parameters.WidgetId", not with the id of your input widget.
both syntax of option 2 and option 1 should work if you fix above remarks.
Dorine
Hi @Kiruthika Balasubramanian ,
unrelated to your actual javascript, can you explain what you are trying to do here ? Why are you using javascript to extract the placeholder, this is information being set at design time.
What will you do with this information you collect, I don't understand the point.
Hi @Dorine Boudry,
Thanks for your idea and I got the solution using my second script by doing the changes you suggested.
var placeholder = document.getElementById($parameters.WidgetId).getAttribute("placeholder");