Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Pradeep Pandey
How to call onClick() in <liferay-ui:custom-attribute>
September 22, 2012 12:05 AM
Answer

Pradeep Pandey

Rank: New Member

Posts: 6

Join Date: July 18, 2012

Recent Posts

Plz anyone tell me , how to call JavaScript function when i clicked on radio button in Liferay custom attribute.
See below, I created one custom attribute " Usertype" that having two radio button.
1-Doctor
2-patient
I want to call java script function by using 'on Click()' event when i click on any button. but following code giving error

<liferay-ui:custom-attribute
className="<%= User.class.getName() %>"
classPK="<%= 0 %>"
editable="<%= true %>"
label="<%= true %>"
name="Usertype" onClick="eventCheck()"/>

ERROR:->Attribute onClick invalid for tag custom-attribute according to TLD
Tejas Kanani
RE: How to call onClick() in <liferay-ui:custom-attribute>
September 22, 2012 12:45 AM
Answer

Tejas Kanani

Rank: Liferay Master

Posts: 653

Join Date: January 6, 2009

Recent Posts

Hi Pradeep,

You are right. There is no "onClick" attribute for liferay-ui:custom-attribute.
If possible, try to bind onclick event dynamically on your element using jQuery.

Thanks,
Tejas
Pradeep Pandey
RE: How to call onClick() in <liferay-ui:custom-attribute>
September 26, 2012 4:09 AM
Answer

Pradeep Pandey

Rank: New Member

Posts: 6

Join Date: July 18, 2012

Recent Posts

Hi Tejas.

would you like to explain ,how to bind onclick event dynamically using jQuery in this scenario.

Thanks,
pradeep
Tejas Kanani
RE: How to call onClick() in <liferay-ui:custom-attribute>
September 28, 2012 1:00 AM
Answer

Tejas Kanani

Rank: Liferay Master

Posts: 653

Join Date: January 6, 2009

Recent Posts

Sorry for late reply.
Can you share the html generated through <liferay-ui:custom-attribute> tag ?
It might help.

Thanks,
Tejas
Manish Kumar Jaiswal
RE: How to call onClick() in <liferay-ui:custom-attribute>
September 28, 2012 4:48 AM
Answer

Manish Kumar Jaiswal

Rank: Regular Member

Posts: 132

Join Date: November 25, 2008

Recent Posts

This is a simple example of onclick on tag .

Regards
Manish
Alireza Zare
RE: How to call onClick() in <liferay-ui:custom-attribute>
September 28, 2012 5:15 AM
Answer

Alireza Zare

Rank: Regular Member

Posts: 110

Join Date: September 3, 2010

Recent Posts

I would do it this way:
...
<aui:button name="button" onClick="<portlet:namespace />doSomthing(); return false;" value="Do somthing" />
...
<aui:script>
function <portlet:namespace />doSomthing() {
......
}
</aui:script>

Regards,
Alireza