1 Reply Latest reply on Apr 28, 2014 6:49 AM by tribule

    Problems with simultaneously Binding

    zamvil Level 1

      Hi,

       

      I'm getting a list of areas, a city and a state thru binding when type the zip code. These data I get from a remote websevice and I have problems when do the binding because is simultaneously in cfselect areas, cfselect city and cfselect state. The error is time out some times and it could be happen in only one field or two.

       

      I inserted diferent delays (sleep(5000)) before execute every bind and it works better but not to 100%. It ocationaly displays too the time out.

       

      I don't know if there are an option to execute the binding secuentially and not simultaneously.

       

      This is my code:

       

      Zip code <cfinput type="text" name="zipcode" message="Capture el código postal a 5 digitos" validate="integer"  required="yes" class="textbox" id="zipcode"  tabindex="7" value="" size="7" maxlength="5"  typeahead="no">

       

      Area <cfselect enabled="No" name="Colonia" class="textbox" tabindex="11" required="yes" multiple="no" selected="12"

                      bind="cfc:cfc.direccion.getColonias({zipcode})"  bindonload="true" />

       

      City <cfselect enabled="No" name="municipio" class="textbox" tabindex="12" required="yes" multiple="no" selected=""

                      bind="cfc:cfc.direccion.getMunicipio({zipcode})"  bindonload="true"/>

       

      State <cfselect enabled="No" name="estado" class="textbox" tabindex="13" required="yes" multiple="no" selected=""

                      bind="cfc:cfc.direccion.getEstado({zipcode})" bindonload="true"

                       />

       

       

      DIRECCION.CFC

      This is one of the functions, The other functions for the Areas and city are very similar. I only change the name of the method. In every function a call two times the remote webservice.

       

      <!--- Get array of media types --->

          <cffunction name="getEstado" access="remote" returnType="array">

                    <cfargument name="cp" type="string" required="true">

       

              <!--- Define variables --->

              <cfset var data="">

              <cfset var result=ArrayNew(2)>

              <cfset var i=0>

       

              <cfif cp is not ''>

                          <cfset sleep(5000)>

              <cfset Catalogo = CreateObject("component", "guarderias-gmx2.componentes.catalogos") />

              <cfset Colonias1 = Catalogo.GetColoniasMexByCodpost("#ARGUMENTS.cp#") />

              <cfset sleep(2750)>

              <cfif Colonias1.recordcount gt 0>

                        <cfset Estado = Catalogo.GetEstadoMexById("#Colonias1.COD_dpto#") />

       

       

                  <cfset result[1][1]=Estado.COD_dpto>

                  <cfset result[1][2]=Estado.TXT_DESC>

                          <cfelse>

                        <cfset result[1][1]=0>

                  <cfset result[1][2]="No existe el Codigo Postal">

       

              </cfif>

              <cfelse>

                        <cfset result[1][1]=0>

                  <cfset result[1][2]="">

              </cfif>         

       

       

              <!--- And return it --->

              <cfreturn result>

          </cffunction>

       

       

       

      Any recomendation is apreciated.

       

      Regards!