problem with submission and validation of empty list

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

problem with submission and validation of empty list

This post has NOT been accepted by the mailing list yet.
I am using the xforms to iterate a list of users in one page, the problem appears when the user is trying to submit the current page when the list of users is empty, in this case the application should checks if the list is empty and shows a error message on top of the page plus should change the color in read for the header of list.

I can't check if the list is empty on submit action, if i put a fake input field with my binder like a constraint it works correctly, how  can I fix this problem, thanks ;

Is possible to use a hidden field in xforms or a input field like hidden ?

I post a piece of code:


                <xf:submission id="debug" method="sendFinal" ref="/USERS"
                        replace="all" resource="quest">
                        <xf:action ev:event="xforms-submit">
                                <xf:rebuild />
                                <xf:recalculate />
                        <xf:action ev:event="xforms-submit-error">
                                <xf:refresh />
                                        There are problems when you submit the form. The invalid fields are colored in red.

                <xf:bind id="bind_users" nodeset="USERS" required="true()" constraint="if(instance('error_instance')/message != '') then (isUserListEmpty(instance('error_instance')/message)) else true()" type="xf:string" />
                <xf:bind extractCsv="false" id="bind_users" nodeset="USERS" repeatableElement="row">
                        <xf:bind id="bind_head_users" nodeset="head"/>
                        <xf:bind id="bind_row_users" nodeset="row">
                                <xf:bind id="bind_user_fname" nodeset="USER_FIRST_NAME" required="true()" type="xf:string"/>
                                <xf:bind id="bind_user_lname" nodeset="USER_LAST_NAME" required="true()" type="xf:string"/>
                                <xf:bind id="bind_user_department" nodeset="USER_DEPARTMENT" required="true()" type="xf:string"/>
                                <xf:bind id="bind_user_address" nodeset="USER_ADDRESS" required="true()" type="xf:string"/>
                                <xf:bind id="bind_user_country" nodeset="USER_COUNTRY" required="true()" type="xf:string"/>
                <xf:group bind="bind_error">
                        <div class="Subsection" dojotype="dijit.TitlePane" open="true"
                                <xf:output bind="error_message" />
                        <br />
                        <div class="tableheader" width="100%">
                                <label>USERS  </label>
                        <xf:repeat appearance="full" bind="bind_users" id="bind_users_id">
                                <xf:group appearance="minimal">
                                        <div class="table-overflow">
                                                <xf:repeat appearance="compact" bind="bind_row_users" id="bind_row_users_id">
                                                        <xf:output bind="bind_user_fname">
                                                                <xf:label>First Name</xf:label>
                                                        <xf:output bind="bind_user_lname">
                                                                <xf:label>Last name </xf:label>
                                                        <xf:output bind="bind_user_department">
                                                                <xf:label>Department </xf:label>
                                                        <xf:output bind="bind_user_address">
                                                        <xf:output bind="bind_user_country">
                <xf:trigger bind="validate_disabled" id="final-validate">
                        <xf:action if="instance('error_instance')/message=''">
                                <xf:send submission="debug" />