Skip to Content (Press Enter)
OutSystems.com
Personal Edition
Community
Support
Training
Training
Online Training
Developer Schools
Boot Camps
Certifications
Tech Talks
Documentation
Documentation
Overview
ODC
O11
Forums
Forge
Get Involved
Get Involved
Jobs
Ideas
Members
Mentorship
User Groups
Platform
Platform
ODC
O11
Search in OutSystems
Log in
Get Started
Back to Forums
Devaraj.K
18
Views
2
Comments
Not able to get Button.Id through JS.
Question
I m using Tree Widget.In the node i use code for Label
"
<a href=
""
#
""
onclick
=
""
OnClickNode(
"
+
BtnOk
.
Id
+
"
); return false;
""
>
"
+
Path_GetDirectoryName
.
DirectoryName
+
"
</a>
"
And also i have a button called "BtnOK" then JS as
function
OnClickNode
(
Btn
)
{
alert
(
Btn
); }
When i Click the Tree node I got [Object] in alert message.I can't get Id of the button.I m trying for
document
.
getElementById
(
Btn
).
click
();
Please tell what Error i did on above Code..
Thanks
RafaOutSystems
MVP
Hi Devaraj,
Try this way:
"
<a href=
""
#
""
onclick
=
""
OnClickNode('"
+
BtnOk
.
Id
+
"'
); return false;
""
>
"
+
Path_GetDirectoryName
.
DirectoryName
+
"
</a>
"
You are missing the ' char inside the ()...
Your actual code, after evaluation generates something like:
onclick
=
"
OnClickNode(wtMyBtName
); return false;
"
and the right way (with
'
char before and after the button id):
onclick
=
"
OnClickNode(
'
wtMyBtName
'
); return false;
"
Regards,
Rafael Pereira
Devaraj.K
Thanks for Your Reply
I worked based upon your reply i got sample problem.Then i used like
onclick=
""
OnClickNode('
"
+
BtnOk
.
Id
+
"
.name');
""
> Now Its Working. Thanks Again
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
See the full guidelines
Loading...