Foren

Home » Liferay Portal » English » 3. Development

Kombinierte Ansicht Flache Ansicht Baumansicht
Threads [ Zurück | Nächste ]
toggle
Pradeep Pandey
How to call onClick() in <liferay-ui:custom-attribute>
22. September 2012 00:05
Antwort

Pradeep Pandey

Rang: New Member

Nachrichten: 6

Eintrittsdatum: 18. Juli 2012

Neue Beiträge

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>
22. September 2012 00:45
Antwort

Tejas Kanani

Rang: Liferay Master

Nachrichten: 655

Eintrittsdatum: 6. Januar 2009

Neue Beiträge

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>
26. September 2012 04:09
Antwort

Pradeep Pandey

Rang: New Member

Nachrichten: 6

Eintrittsdatum: 18. Juli 2012

Neue Beiträge

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>
28. September 2012 01:00
Antwort

Tejas Kanani

Rang: Liferay Master

Nachrichten: 655

Eintrittsdatum: 6. Januar 2009

Neue Beiträge

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>
28. September 2012 04:48
Antwort

Manish Kumar Jaiswal

Rang: Regular Member

Nachrichten: 133

Eintrittsdatum: 25. November 2008

Neue Beiträge

This is a simple example of onclick on tag .

Regards
Manish
Alireza Zare
RE: How to call onClick() in <liferay-ui:custom-attribute>
28. September 2012 05:15
Antwort

Alireza Zare

Rang: Regular Member

Nachrichten: 110

Eintrittsdatum: 3. September 2010

Neue Beiträge

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