Fórum

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

thumbnail
Pradeep Pandey, modificado 11 Anos atrás.

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

New Member Postagens: 6 Data de Entrada: 19/07/12 Postagens Recentes
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, modificado 11 Anos atrás.

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

Liferay Master Postagens: 654 Data de Entrada: 06/01/09 Postagens Recentes
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, modificado 11 Anos atrás.

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

New Member Postagens: 6 Data de Entrada: 19/07/12 Postagens Recentes
Hi Tejas.

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

Thanks,
pradeep
thumbnail
Tejas Kanani, modificado 11 Anos atrás.

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

Liferay Master Postagens: 654 Data de Entrada: 06/01/09 Postagens Recentes
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, modificado 11 Anos atrás.

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

Regular Member Postagens: 153 Data de Entrada: 25/11/08 Postagens Recentes
This is a simple example of onclick on tag .

Regards
Manish
thumbnail
Alireza Zare, modificado 11 Anos atrás.

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

Regular Member Postagens: 110 Data de Entrada: 03/09/10 Postagens Recentes
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