Share

Rich Client Faces

The forum address has changed, you have been automatically redirected. Please update any bookmarks to use the new URL.

Subscribe

messageDialog tag duplicates javascript code

You are viewing a single message from this topic. View all messages.

  1. 2009-09-03 13:37:06 UTC
    Hello,
    I have a problem with the messageDialog tag that duplicates javascript code in the selectionListener attribute into the generated v:events attribute (in v:init tag).

    This code :
    <v:messageDialog id="alerteDejaValide" visible="false" hiddenMode="ignore"
    text="#{MessageBean.get['gestionDossier.message.CHANGEMENT_STATUT']}"
    title=""
    binding="#{DossierBean.refMessage4}"
    defaultValue="Annuler_02"
    selectionListener="return cover(event);#{DossierBean.modifierDossier}"
    imageURL="$context/images/ico_avertiss.gif" height="150"
    width="450" styleClass="avertiss" >
    <core:selectItem itemValue="Confirmer_02" itemLabel="#{MessageBean.get['commun.texte.CONFIRMER_MAJ']}" />
    <core:selectItem itemValue="Annuler_02" itemLabel="#{MessageBean.get['commun.texte.ANNULER_MAJ']}" />
    </v:messageDialog>

    Generates this one in the page source :
    <v:init id="validerForm__alerteDejaValide" v:class="f_messageDialog" v:events="selection:return cover(event):return cover(event):return cover(event)|selection:submit" v:title="" v:text="Le statut du dossier va &ecirc;tre modifi&eacute; : veuillez confirmer ou annuler" v:defaultValue="Annuler_02" v:width="450" v:height="150" v:styleClass="avertiss" v:imageURL="/euroforms/images/ico_avertiss.gif"></v:init>
    <script>//<![CDATA[
    var _4=_rcfacesClassLoader.f_init("validerForm__alerteDejaValide");
    _4.f_addAction("Confirmer_02","CONFIRMER",false,false);
    _4.f_addAction("Annuler_02","ANNULER",false,true);
    _4.f_openMessage();
    //]]></script>

    In fact, we can see this line :
    v:events="selection:return cover(event):return cover(event):return cover(event)|selection:submit"

    The Javascript function is :
    function cover(evt) {
    var value = evt.f_getValue();
    if (value.indexOf("Confirmer") >= 0) {
    hideMessageDialog();
    return true;
    }
    if (value.indexOf("Annuler") >= 0 || value.indexOf("Fermer") >= 0) {
    return false;
    }
    return false;
    }

    So it returns true or false and executes or not the next function in the same bloc of instructions.
    The problem is that it generates a bug because of multiple submits.

    How can I avoid this behavior of duplicated javascript code ?

    Thanks a lot !
< Previous | 1 | Next >

Add a Reply

This forum does not allow anonymous participation.

Log in to add a reply. Not registered? Create an account to participate and receive email updates when replies are posted to this topic.