You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Michael Kakuschky <ka...@elbe-net.de> on 2010/09/23 22:29:56 UTC
[tobago] Validation in Popups
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 ®ards Michael
Re: [tobago] tc:input und tx:input components not updated
Posted by Michael Kakuschky <ka...@elbe-net.de>.
Since I downgraded my tobago (1.0.30) application from myfaces 1.2.8
to myfaces 1.1.8 to get popups validation working I have also some
problems with the subforms on non popup pages.
It seems that the scope of the Forms follows other rules with myfaces
1.1.8 than 1.2.8. In some cases the validation rules of neighbour forms
are checked and blocking submission of the currently used form.
Are there any general rules where tc:form elements have to be positioned
to get not wired with the scopes of validation in myfaces 1.1.8
Kind regards Michael
[tobago] tc:input und tx:input components not updated
Posted by Michael Kakuschky <ka...@elbe-net.de>.
Hello, I downgraded my tobago (1.0.30) application from myfaces 1.2.8
to myfaces 1.1.8 to get the popup validation working - It works now
thanks for the help.
Now I got another problem. Since the downgrade the tc:in and tx:in
elements not updated with the attributes of the underlaying controller
bean.
But If I bind the attributes to tc:out elements the values are shown but
not editable for sure.
What I do is I have a list of customers. If the user selects a customer
it's loaded into an cutomer object signed as value to a formular to edit
the customer.
The page is loaded and the formular should contain the existing values
but it does not work for input components.
<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc"%>
<%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
. . .
Not working:
<tc:tab label="main">
<tc:panel id="customerDataPanel">
<f:facet name="layout">
<tc:gridLayout columns="1*"rows="fixed;*" />
</f:facet>
<tc:cell>
<tx:in value="#{myController.selectedCustomer.first_name}" />
</tc:cell>
working:
<tc:tab label="main">
<tc:panel id="customerDataPanel">
<f:facet name="layout">
<tc:gridLayout columns="1*"rows="fixed;*" />
</f:facet>
<tc:cell>
<tc:out value="#{myController.selectedCustomer.first_name}" />
</tc:cell>
. . . . .
I debug the Beans and the objects and attributes are initialized correctly
Has somebody an idea?
Kind regards Michael
Re: [tobago] Validation in Popups
Posted by Michael Kakuschky <ka...@elbe-net.de>.
Hello, the problem is solved. Thanks Udo!
The reason was that I was using MyFaces 1.2.8 in combination with tobago
1.0.30.
Since I downgrade to MyFaces 1.1.8 the validation in popups is working.
Regards Michael
Am 08.10.2010 18:30, schrieb Udo Schnurpfeil:
> Hi Michael,
>
> I've just rechecked you sample, but I can't reproduce the problem. So,
> it may depends on some odd diffence of my and you environment.
>
> Let be describe what I did:
>
> 1. svn co
> https://svn.apache.org/repos/asf/myfaces/tobago/tags/tobago-1.0.30/example/demo/
> demo
> 2. cd demo
> 3. edit src/main/webapp/popup-test.jsp (this is a modified version of
> you sniplet, the EL to the Java code was removed)
> <%@ taglib uri="http://myfaces.apache.org/tobago/component"
> prefix="tc" %>
> <%@ taglib uri="http://myfaces.apache.org/tobago/extension"
> prefix="tx" %>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
> <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
>
> <layout:overview>
> <jsp:body>
> <tc:box label="Test for Popups to be open in case of an validation
> error">
> <f:facet name="layout">
> <tc:gridLayout rows="fixed;1*"/>
> </f:facet>
>
> <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="some value" required="true"/>
> </tc:cell>
> <tc:cell>
> <tc:button width="100" label="add">
> <tc:attribute name="popupClose" value="afterSubmit"/>
> </tc:button>
> </tc:cell>
> </tc:box>
> </tc:popup>
> </f:facet>
> </tc:button>
> </tc:panel>
> </tc:form>
>
> </tc:box>
> </jsp:body>
> </layout:overview>
> 4. mvn jetty:run-exploded
> 5. browse: http://localhost:8080/tobago-example-demo/faces/popup-test.jsp
> 6. click "new item" -> popup opens
> 7. click "add" -> popup closes
> 8. click "new item" -> popup opens
> 9. remove the value of "contact name"
> 10. click "add" -> popup keeps open and the input will be colored red
>
> Can you check, if this works the same way on your box.
>
> Regards,
>
> Udo
>
>
> Am 04.10.10 10:59, schrieb Volker Weber:
>> 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<ka...@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®ards Michael
>>>>>>
>>
>>
Re: [tobago] Validation in Popups
Posted by Michael Kakuschky <ka...@elbe-net.de>.
Hello Udo, with the way you described it works well. My problem is now
that I use apache tomcat instead eclipse and I'm not using maven. So I
have to find out which is the responsible difference.
Best regards Michael
Am 09.10.2010 08:54, schrieb Udo Schnurpfeil:
> Addition (but I don't think the problem rely on that):
> Server:
> Mac OS 10.6.4, Maven 2.2.1, Java 1.6.0_20
> Clients:
> Firefox 3.6.10, Mac OS 10.6.4
> Safari 5.0.2, Mac OS 10.6.4
> Internet Explorer 6.0, Windows XP SP 3
> Internet Explorer 8.0, Windows 7
> Firefox 3.6.8, Ubuntu 10.4
>
> Am 08.10.10 18:30, schrieb Udo Schnurpfeil:
>> Hi Michael,
>>
>> I've just rechecked you sample, but I can't reproduce the problem.
>> So, it may depends on some odd diffence of my and you environment.
>>
>> Let be describe what I did:
>>
>> 1. svn co
>> https://svn.apache.org/repos/asf/myfaces/tobago/tags/tobago-1.0.30/example/demo/
>> demo
>> 2. cd demo
>> 3. edit src/main/webapp/popup-test.jsp (this is a modified version of
>> you sniplet, the EL to the Java code was removed)
>> <%@ taglib uri="http://myfaces.apache.org/tobago/component"
>> prefix="tc" %>
>> <%@ taglib uri="http://myfaces.apache.org/tobago/extension"
>> prefix="tx" %>
>> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
>> <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
>>
>> <layout:overview>
>> <jsp:body>
>> <tc:box label="Test for Popups to be open in case of an validation
>> error">
>> <f:facet name="layout">
>> <tc:gridLayout rows="fixed;1*"/>
>> </f:facet>
>>
>> <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="some value" required="true"/>
>> </tc:cell>
>> <tc:cell>
>> <tc:button width="100" label="add">
>> <tc:attribute name="popupClose" value="afterSubmit"/>
>> </tc:button>
>> </tc:cell>
>> </tc:box>
>> </tc:popup>
>> </f:facet>
>> </tc:button>
>> </tc:panel>
>> </tc:form>
>>
>> </tc:box>
>> </jsp:body>
>> </layout:overview>
>> 4. mvn jetty:run-exploded
>> 5. browse:
>> http://localhost:8080/tobago-example-demo/faces/popup-test.jsp
>> 6. click "new item" -> popup opens
>> 7. click "add" -> popup closes
>> 8. click "new item" -> popup opens
>> 9. remove the value of "contact name"
>> 10. click "add" -> popup keeps open and the input will be colored red
>>
>> Can you check, if this works the same way on your box.
>>
>> Regards,
>>
>> Udo
>>
>>
>> Am 04.10.10 10:59, schrieb Volker Weber:
>>> 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<ka...@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®ards Michael
>>>>>>>
>>>
>>>
>>
Re: [tobago] Validation in Popups
Posted by Udo Schnurpfeil <ud...@schnurpfeil.de>.
Addition (but I don't think the problem rely on that):
Server:
Mac OS 10.6.4, Maven 2.2.1, Java 1.6.0_20
Clients:
Firefox 3.6.10, Mac OS 10.6.4
Safari 5.0.2, Mac OS 10.6.4
Internet Explorer 6.0, Windows XP SP 3
Internet Explorer 8.0, Windows 7
Firefox 3.6.8, Ubuntu 10.4
Am 08.10.10 18:30, schrieb Udo Schnurpfeil:
> Hi Michael,
>
> I've just rechecked you sample, but I can't reproduce the problem. So,
> it may depends on some odd diffence of my and you environment.
>
> Let be describe what I did:
>
> 1. svn co
> https://svn.apache.org/repos/asf/myfaces/tobago/tags/tobago-1.0.30/example/demo/
> demo
> 2. cd demo
> 3. edit src/main/webapp/popup-test.jsp (this is a modified version of
> you sniplet, the EL to the Java code was removed)
> <%@ taglib uri="http://myfaces.apache.org/tobago/component"
> prefix="tc" %>
> <%@ taglib uri="http://myfaces.apache.org/tobago/extension"
> prefix="tx" %>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
> <%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
>
> <layout:overview>
> <jsp:body>
> <tc:box label="Test for Popups to be open in case of an validation
> error">
> <f:facet name="layout">
> <tc:gridLayout rows="fixed;1*"/>
> </f:facet>
>
> <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="some value" required="true"/>
> </tc:cell>
> <tc:cell>
> <tc:button width="100" label="add">
> <tc:attribute name="popupClose" value="afterSubmit"/>
> </tc:button>
> </tc:cell>
> </tc:box>
> </tc:popup>
> </f:facet>
> </tc:button>
> </tc:panel>
> </tc:form>
>
> </tc:box>
> </jsp:body>
> </layout:overview>
> 4. mvn jetty:run-exploded
> 5. browse: http://localhost:8080/tobago-example-demo/faces/popup-test.jsp
> 6. click "new item" -> popup opens
> 7. click "add" -> popup closes
> 8. click "new item" -> popup opens
> 9. remove the value of "contact name"
> 10. click "add" -> popup keeps open and the input will be colored red
>
> Can you check, if this works the same way on your box.
>
> Regards,
>
> Udo
>
>
> Am 04.10.10 10:59, schrieb Volker Weber:
>> 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<ka...@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®ards Michael
>>>>>>
>>
>>
>
Re: [tobago] Validation in Popups
Posted by Udo Schnurpfeil <ud...@schnurpfeil.de>.
Hi Michael,
I've just rechecked you sample, but I can't reproduce the problem. So,
it may depends on some odd diffence of my and you environment.
Let be describe what I did:
1. svn co
https://svn.apache.org/repos/asf/myfaces/tobago/tags/tobago-1.0.30/example/demo/
demo
2. cd demo
3. edit src/main/webapp/popup-test.jsp (this is a modified version of
you sniplet, the EL to the Java code was removed)
<%@ taglib uri="http://myfaces.apache.org/tobago/component" prefix="tc" %>
<%@ taglib uri="http://myfaces.apache.org/tobago/extension" prefix="tx" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib tagdir="/WEB-INF/tags/layout" prefix="layout" %>
<layout:overview>
<jsp:body>
<tc:box label="Test for Popups to be open in case of an validation error">
<f:facet name="layout">
<tc:gridLayout rows="fixed;1*"/>
</f:facet>
<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="some value" required="true"/>
</tc:cell>
<tc:cell>
<tc:button width="100" label="add">
<tc:attribute name="popupClose" value="afterSubmit"/>
</tc:button>
</tc:cell>
</tc:box>
</tc:popup>
</f:facet>
</tc:button>
</tc:panel>
</tc:form>
</tc:box>
</jsp:body>
</layout:overview>
4. mvn jetty:run-exploded
5. browse: http://localhost:8080/tobago-example-demo/faces/popup-test.jsp
6. click "new item" -> popup opens
7. click "add" -> popup closes
8. click "new item" -> popup opens
9. remove the value of "contact name"
10. click "add" -> popup keeps open and the input will be colored red
Can you check, if this works the same way on your box.
Regards,
Udo
Am 04.10.10 10:59, schrieb Volker Weber:
> 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<ka...@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®ards Michael
>>>>>
>
>
Re: [tobago] Validation in Popups
Posted by Volker Weber <v....@inexso.de>.
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 <ka...@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 ®ards 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
Re: [tobago] Validation in Popups
Posted by Michael Kakuschky <ka...@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 ®ards Michael
>>>
Re: [tobago] Validation in Popups
Posted by Michael Kakuschky <ka...@elbe-net.de>.
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 ®ards Michael
>>
Re: [tobago] Validation in Popups
Posted by Udo Schnurpfeil <ud...@schnurpfeil.de>.
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 ®ards Michael
>