0

I 'm trying to call a method in java through the SelectOneRadio component, but nothing happen. But the component is created by my company to accept ENUM.

THE COMPONENT:

<composite:interface>
<composite:attribute name="label" />
<composite:attribute name="value" />
<composite:attribute name="converter" />
<composite:attribute name="lista" />
<composite:attribute name="enumClass" />
<composite:attribute name="id" default="campo"/>
<composite:attribute name="columns" default="1"/>
<composite:attribute name="required" default="false"/>
<composite:attribute name="disabled" default="false"/>
<composite:attribute name="tamanhoTotal" default="12"/>
<composite:attribute name="tamanho" default="10"/>
<composite:attribute name="tamanhoLabel"/>
<composite:attribute name="layout" default="lineDirection"/>

<composite:clientBehavior name="change" event= "change" targets = "campo"/>

<composite:implementation>
        <p:selectOneRadio id="#{cc.attrs.id}" 
                            value="#{cc.attrs.value}" 
                            disabled="#{cc.attrs.disabled}" 
                            columns="#{cc.attrs.columns}" 
                            layout="#{cc.attrs.layout}" 
                            required="#{cc.attrs.required}" 
                            label="#{cc.attrs.label}"
                            converter="#{cc.attrs.converter}"
                            requiredMessage="#{cc.attrs.label}  : Campo obrigatório">
            <f:selectItems value="#{referenciaMap[cc.attrs.enumClass]}"/>
        </p:selectOneRadio>     

And a try this until now :

This is MY XHTML :

<campo:radio enumClass="StatusTituloEnum"
                                                            label="Situação" tamanho="1" tamanhoTotal="1"
                                                            columns="1" layout="grid"
                                                            disabled="#{!recTituloCriteria.disableRadioStatus}"
                                                            converter="#{StatusTituloConverterById}">
                                                            <p:ajax event="change" process="@this"
                                                                    update=":form:idTabela" listener="#{recTituloCriteria.handleKeyEvent}" />
                                                        </campo:radio>

And this is my method in JAVA :

    public void handleKeyEvent() {
    //text = text.toUpperCase();
    System.out.println("hi");
}
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555

1 Answers1

0

Some part of your <campo:radio> in XHTML is missing. Can you please edit it? Are there any errors in your web browser console?

Probably it helps to add onclick="this.form.submit();" in your selectOneRadio.

Another suggestion is to use valueChangeListener if you don't insist on ajax calls.

EDIT: Try to change the change event to a click event. I think this will do...