Fórumok

How to call onClick() in <liferay-ui:custom-attribute>

thumbnail
Pradeep Pandey, módosítva 11 év-val korábban

How to call onClick() in <liferay-ui:custom-attribute>

New Member Bejegyzések: 6 Csatlakozás dátuma: 2012.07.19. Legújabb bejegyzések
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
thumbnail
Tejas Kanani, módosítva 11 év-val korábban

RE: How to call onClick() in <liferay-ui:custom-attribute>

Liferay Master Bejegyzések: 654 Csatlakozás dátuma: 2009.01.06. Legújabb bejegyzések
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
thumbnail
Pradeep Pandey, módosítva 11 év-val korábban

RE: How to call onClick() in <liferay-ui:custom-attribute>

New Member Bejegyzések: 6 Csatlakozás dátuma: 2012.07.19. Legújabb bejegyzések
Hi Tejas.

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

Thanks,
pradeep
thumbnail
Tejas Kanani, módosítva 11 év-val korábban

RE: How to call onClick() in <liferay-ui:custom-attribute>

Liferay Master Bejegyzések: 654 Csatlakozás dátuma: 2009.01.06. Legújabb bejegyzések
Sorry for late reply.
Can you share the html generated through <liferay-ui:custom-attribute> tag ?
It might help.

Thanks,
Tejas
thumbnail
Manish Kumar Jaiswal, módosítva 11 év-val korábban

RE: How to call onClick() in <liferay-ui:custom-attribute>

Regular Member Bejegyzések: 153 Csatlakozás dátuma: 2008.11.25. Legújabb bejegyzések
This is a simple example of onclick on tag .

Regards
Manish
thumbnail
Alireza Zare, módosítva 11 év-val korábban

RE: How to call onClick() in <liferay-ui:custom-attribute>

Regular Member Bejegyzések: 110 Csatlakozás dátuma: 2010.09.03. Legújabb bejegyzések
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