myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Volker Weber <v.we...@inexso.de>
Subject Re: [tobago] Validation in Popups
Date Mon, 04 Oct 2010 08:59:47 GMT
Hi Michael,

yes we have validation in Popups, but this is a bit hack like, nothing
to show as example.

The problem is the partial rendering and the popup handling in tobago 1.0.x:

If you need validation inside a popup, you should not close the popup
via popupClose attribute, but rerender the popup content partial and,
on success, close the popup via hidden button and javascript.

something like this should work, if you set the
#{myController.closePopup} value in your newItem action.

<tc:cell>
  <f:facet name="layout">
    <tc:gridLayout colums="fixed;1*" />
  </f:facet>
  <tc:button width="100" label="add" action="#{myController.newitem}">
    <tc:attribute name="popupClose" value="afterSubmit"/>
  </tc:button>
  <tc:text escape="false"
             rendered="#{myController.closePopup}"
             value="<script
type=\"text/javascript\">Tobago.submitAction('full clientId of
hiddenCloseButton');</script>" />
  <f:facet name="hiddenCloseButton">
    <tc:button id="hiddenCloseButton" >
      <tc:attribute name="popupClose" value="afterSubmit"/>
    </tc:button>
  </f:facet>
</tc:cell>

In tobago 1.5 this would be easier.

Regards,
    Volker

2010/10/4 Michael Kakuschky <kakuschky@elbe-net.de>:
>  Does nobody has an working example for validation in popus?
>
> Regards Michael
>
> Am 29.09.2010 08:57, schrieb Michael Kakuschky:
>>
>>  Hello Udo, thanks for the answer but my form is already around the
>> tc:button which I used to open the popup. Here is a snippset of my original
>> version. The popup works and the form data will processed. Only validations
>> and required checks doesn't work. In case of missing or wrong data the pop
>> is just closing without calling the action method of the popups submit
>> button. Can you show on this example what's todo or maybe wrong ?
>>
>> Thanks & best regards Michael
>>
>> <tc:form>
>> <tc:panel>
>> <f:facet name="layout">
>> <tc:gridLayout  rows="fixed" columns="fixed" />
>> </f:facet>
>> <tc:button label="new item">
>> <tc:attribute name="renderedPartially" value="non_modal_popup1"/>
>> <f:facet name="popup">
>> <tc:popup width="500" height="325" id="non_modal_popup1" modal="true" >
>> <tc:box label="create new item">
>> <f:facet name="layout">
>> <tc:gridLayout columns="1*" rows="fixed;fixed" />
>> </f:facet>
>> <tc:cell>
>> <tx:in label="contact name" value="#{myController.itemToAdd.contact_name}"
>> required="true" />
>> </tc:cell>
>> <tc:cell>
>> <tc:button width="100" label="add" action="#{myController.newitem}">
>> <tc:attribute name="popupClose" value="afterSubmit"/>
>> </tc:button>
>> </tc:cell>
>> </tc:box>
>> </tc:popup>
>> </f:facet>
>> </tc:button>
>> </tc:panel>
>> </tc:form>
>>
>> Am 28.09.2010 15:12, schrieb Udo Schnurpfeil:
>>>
>>>  Hello Michael,
>>>
>>> please try to put the form outside of the command tag, which opens the
>>> popup. This should solve your problems.
>>>
>>> The background is: The popup must be inside the form to consider it was
>>> already active.
>>>
>>> Regards,
>>>
>>> Udo
>>>
>>> Am 23.09.10 22:29, schrieb Michael Kakuschky:
>>>>
>>>>  Hello, I have a form in a popup. Now it works fine and I add some
>>>> validators to it. I checked that they are executed and throws the
>>>> ValidatorException if the input does not match the requirements.
>>>>
>>>> In case of exceptions the action behind the popup form is not executed
>>>> but unfortunately the popup is closed without any notification about the
>>>> wrong input. Is there a way to keep the popup open so that the user is
>>>> informed about the wrong input?
>>>>
>>>> thanks &regards Michael
>>>>
>



-- 
inexso - information exchange solutions GmbH
Ofener Str. 30      | 26121 Oldenburg
Tel.: +49 441 219 730 56 |
FAX:  +49 441 219 730 66 | eMail: volker.weber@inexso.de

Firmensitz: Hamburg   | Amtsgericht Hamburg, HRB 84273
Geschäftsführer: Stefan Schulte, Michael Terschüren, Dirk Fangohr

Mime
View raw message