0 Replies Latest reply on Jun 20, 2014 7:34 AM by userCold9

    Javascript inside cfajaximport

    userCold9 Level 1

      Hi,

       

      I am trying to us javascript in a page that is using cfajaximport.

       

      The issue is checking a text box for spaces and checking the radio button if it has been selected.

      The the textbox is called row1value1 and the radio button is called firstradio1.

      The function is called checkcommunityNF() which is called from the firstradio1 radio button onClick function.

      Per my research, I have added the CFWINDOW in the cfajaximport tag.

      I can not get the message to appear when the conditions are met.

       

       

      I have posted the code below.

       

      <cfparam name="url.myEdit" default="" />
      <cfparam name="myResult" default="" />
      <cfparam name="myLimit" default="" />

      <cfajaximport tags="CFINPUT-DATEFIELD, CFAJAXPROXY, CFINPUT-AUTOSUGGEST, CFPOD, CFTOOLTIP, CFSPRYDATASET-JSON, CFTEXTAREA, CFDIV, CFLAYOUT-TAB, CFFORM, CFWINDOW">  
      <cfoutput>
      <script Language="JAVASCRIPT">
      function checkcommunityNF()
      {
       
      if (document.two.row1value1.value =="" && document.getElementById('firstradio1').value == 1)
      {
      alert("The xxxx.")
      return false;


      }
      }
      </script>


      <CFQUERY NAME="getSPHCBSNumber" DATASOURCE="#this.datasource#">
      SELECT MAX(HCBSBENID) as maxEventNumber
      FROM SPHCBSSERVICES
      WHERE (unique_index = '#Session.ULTC1002.ClientUID#'
      AND EVENT_NUMBER = '#Session.ULTC1002.SPEvent#')  
      </CFQUERY>

      <cfif #getSPHCBSNumber.maxEventNumber# GT "">
      <cfset ServiceHCBSID = #getSPHCBSNumber.maxEventNumber# + 1>
      <cfelse>
      <cfset ServiceHCBSID = 1>
      </cfif>

       

      <!---<strong>#url.myEdit#</strong>--->
      <CFQUERY NAME="getFrequencyList" DATASOURCE="#this.datasource#">
      SELECT   *
      FROM  SPSERVICETYPECODE
      WHERE   servicetypeid = '#url.myEdit#'   
      </CFQUERY>
         
      <h5>#getFrequencyList.ServiceDescription#</h5>
      <P> </P>
         
      <cfform name="two" id="two1" action="diag2action.cfm" method="post">

      <!---<P>TWO</P>--->
      <P> Service:<cfinput name="HCBSBenefitEntryID"  id="HCBSBenefitEntryID" value="#ServiceHCBSID#" type="hidden">#ServiceHCBSID#</td></tr>
      <table border="1" bordercolor="##58322c;" align="right" width="200" height="50">
      <cfparam name="form.UnitMultiplier" default="1" >
      <cfparam name="form.UnitLimit" default=" " >
      <tr><td align="center"><P align="left"><b>Unit Limit:</b>
      <cfif #getFrequencyList.CombinationLimit# eq '1'>Combination
        </cfif>


      <cfif #isdefined("getFrequencyList.UnitsLimit")# eq '1'>
         <cfif #getFrequencyList.UnitsLimit# neq ''>
          <cfinput name="UnitLimit" id="UnitLimit" type="hidden" value="#getFrequencyList.UnitsLimit#"> #getFrequencyList.UnitsLimit#
         <cfelse>
          <cfinput name="UnitLimit" id="UnitLimit" type="hidden" value="">
         </cfif>
      </cfif>
      <!--- #getFrequencyList.unitslimit# #getFrequencyList.unitslimitdesc# --->
      <P align="left"><b>Unit Measurement:</b>
      <br>1 UNIT = #getFrequencyList.unitcalc# #getFrequencyList.unitdesc#
      <cfif #getFrequencyList.UnitMultiplier# neq ''>
      <cfinput name="UnitMultiplier" id="UnitMultiplier" type="hidden" value="#getFrequencyList.UnitMultiplier#">
      <cfelse>
      <cfinput name="UnitMultiplier" id="UnitMultiplier" type="hidden" value="#getFrequencyList.UnitMultiplier#">
      </cfif> <!---#getFrequencyList.unitmultiplier#--->
      </table> 
        
         
      <table border="1" bordercolor="##58322c;" align="right"" width="200" height="50">
         
      <tr><td align="center"> <P>Hours
      <cfparam name="form.HoursAvailable" default=" ">
      <cfdiv name="HoursAvailable"  bindonload="no" bind="cfc:bus.common.hcbsservicemath.getHoursAvailable({StartDate@change},{EndDate@change})">
      </td></tr>
        
        <tr><td align="center"> 
        <P>Days
      <cfparam name="form.DaysAvailable" default=" ">
      <cfdiv name="DaysAvailable"  bindonload="no" bind="cfc:bus.common.hcbsservicemath.getDaysAvailable({StartDate@change},{EndDate@change})">
      </td></tr>
          <tr><td align="center">  
      <P>Weeks
      <cfparam name="form.WeeksAvailable" default=" ">
      <cfdiv name="WeeksAvailable"  bindonload="no" bind="cfc:bus.common.hcbsservicemath.getWeeksAvailable({StartDate@change},{EndDate@change})">


      </td></tr> 
      <tr><td align="center">  
      <P>Months
      <cfparam name="form.MonthsAvailable" default=" ">
      <cfdiv name="MonthsAvailable"  bindonload="no" bind="cfc:bus.common.hcbsservicemath.getMonthsAvailable({StartDate@change},{EndDate@change})">


      </td></tr>
      </table>

      <P> </P>
                     <P> </P>

      <p>Service Start Date:<font color="##990000">*</font>

      <CFINPUT name="StartDate" TYPE="datefield" value="" bindonload="no" required="yes" message="Service Start Date Required">
                  
                    <P> </P>
                     <P> </P>
      <P>Service End Date:<font color="##990000">*</font>
      <CFINPUT name="EndDate" TYPE="datefield" value="" bindonload="no" required="yes" message="Service End Date Required">
                  <P> </P>
                 <P> </P>  

      <P> </P>
      <P> </P> 
      <table border="0" bordercolor="##58322c;" align="left"" width="600" height="50" cellpadding="10" cellspaing="4">

      <tr><td align="center">
      <cfif  #getFrequencyList.serviceitem# eq '1'>
      <P align="left">Item Description: <font color="##990000">*</font>
      <cfinput name="Item" type="text" value="" required="yes" message="Item Description required"> 

      <cfelse>
      </cfif>
      </td></tr>
      <tr><td align="center">

      <table border="0" bordercolor="##58322c;" align="left" width="600" height="50" cellpadding="7" cellspaing="4">
      <tr>
      <td align="center" colspan="4">
        <hr size="3"  style="color:##58322c;">
         <label for='firstradio'>  
         <cfparam name="form.row1value1" default="1">
         <cfparam name="form.row1value2" default="1">
         <cfparam name="form.row1value3" default="1">
        </td></tr>
        <tr><td width="25%"><cfinput name="row1value1" id="row1value1a" type="text" size="8" value="" bindonload="no" validate="regular_expression" pattern="^\d*\.?((25)|(50)|(5)|(75)|(0)|(00))?$" message="Enter the correct format whole numbers and/or quarter hours. Use decimals value ending in 0.25 0.50 and 0.75 (leading zero or number first required)."><cfinput name="row1description1" id="row1description1" type="hidden" value="Hours/Day">Hours/Day</td>
         <td width="25%"><cfinput name="row1value2" id="row1value2" type="text" size="8" value="" bindonload="no" validate="integer" range="0,7" message="Enter Days (0-7). You cannot enter more than 7 days a week."><cfinput name="row1description2" id="row1description2" type="hidden" value="Days/Week">Days/Week</td>  
         <td width="25%"><cfinput name="row1value3" id="row1value3" type="text" size="8" value="" bindonload="no" validate="integer" range="0,52" message="Enter weeks a year (0-52). You cannot enter more than 52 weeks a year."><cfinput name="row1description3" id="row1description3" type="hidden" value="Weeks/Year">Weeks/Year</td>
         <td width="25%"> <cfinput type="radio" onClick="checkcommunityNF()" id="firstradio1" name="CalcRow" value="1">Select Row  
         </label>
       
      </td>
      </tr>
      <tr>
      <td align="center" colspan="4">
        <hr size="3"  style="color:##58322c;">
         <label for='secondradio'>  
         <cfparam name="form.row2value1" default="1">
         <cfparam name="form.row2value2" default="1">
         </td>
      </tr>  
      <tr>
        <td width="25%"><cfinput name="row2value1" id="row2value1" type="text" size="8"  value="" bindonload="no" validate="regular_expression" pattern="^\d*\.?((25)|(50)|(5)|(75)|(0)|(00))?$"  message="Enter the correct format whole nubers or quarter hours. (Use must use decimals value ending in 0.25 0.50 and 0.75 leading zero or number required.)">Hours/Week
         <cfinput name="row2description1" id="row2description1" type="hidden" value="Hours/Week">  
         <td width="25%"><cfinput name="row2value2" id="row2value2" type="text" size="8"  value="" bindonload="no" 
        validate="integer" range="0,52" message="Enter weeks a year (0-52). You cannot enter more than 52 weeks a year.">Weeks/Year
         <cfinput name="row2description2" id="row2description2" type="hidden" value="Weeks/Year"></td>
         <td width="25%"></td>
         <td width="25%"> <cfinput type='radio' id='secondradio' name="CalcRow" value='2'>Select Row   
         </label>  
        </td>
      </tr>


      <tr><td align="center" colspan="4"><hr size="3" style="color:##58322c;"><label for='thirdradio'><cfparam name="form.row3value1" default="1"><cfparam name="form.row3value2" default="1">
      </td></tr>  
      <tr>
         <td width="25%"><cfinput name="row3value1" id="row3value1" type="text" size="8"  value="" bindonload="no" validate="regular_expression" pattern="^\d*\.?((25)|(50)|(5)|(75)|(0)|(00))?$"  message="Enter the correct format whole nubers or quarter hours. (Use must use decimals value ending in 0.25 0.50 and 0.75 leading zero or number required.)">Hours/Month<cfinput name="row3description1" id="row3description1" type="hidden" value="Hours/Month"></td>
         <td width="25%"><cfinput name="row3value2" id="row3value2" type="text" size="8"  value="" bindonload="no" validate="integer" range="0,12" message="Enter months 0-12. You cannot enter more than 12 months a year.">Month/Year<cfinput name="row3description2" id="row3description2" type="hidden" value="Month/Year"></td>
         <td width="25%"> </td>
         <td width="25%"> <cfinput type='radio' id='thirdradio' name="CalcRow" value='3'>Select Row</td></label>
      </tr>

       


      </table>
      <tr><td align="right" colspan="4"><hr size="3" style="color:##58322c;"> </td></tr>
      <tr><td align="left" colspan="4"><font color="##990000">*</font> To enter decimals you must use a leading zero. Ex. 0.50 instead of .50.</td></tr>

       


      <tr><td align="right" colspan="4"><hr size="3"  style="color:##58322c;"> </td></tr>
      <tr>
      <td align="right" colspan="4">

         <a href="" onClick="ColdFusion.Layout.selectTab('HCBSServices','HCBSServiceFrequency');
      return false;"><H6>Update Calculation</H6></a>
      </td>
      </tr>
      <tr><td align="left" colspan="4">
      <cfparam name="form.OverLimitApproval" default="0">
      <cfif #getFrequencyList.StateApproval# eq '1'>
      <P>Request for Over Limit Approval:<font color="##990000">*</font>
      <cfinput name="OverLimitApproval" id="OverLimitApproval" type="checkbox" value="1" message="Over the Limit required">
      <cfelse>
      </cfif>

       </td></tr>

      <tr><td align="center">
      <cfparam name="form.TotalUnitsParCalc" default="0">
      <P align="left">Total calculated units:<font color="##990000">*</font>

      <cfif #isdefined("getFrequencyList.unitslimit")# eq '1'>
      <cfinput name="TotalUnitsParCalc" required="yes" bindonload="yes"  readonly="yes"
      bind="cfc:bus.common.diag2TotalCalc.getCalcs({StartDate@change},{EndDate@change},{CalcRow@change},{row1value1@keyup},{row1value2@keyup} ,{row1value3@keyup},{row2value1@keyup},{row2value2@keyup},{row3value1@keyup},{row3value2@k eyup},{UnitMultiplier@keyup},{UnitLimit@keyup})"
          size="60" validate="regular_expression" pattern="^\d*\.?((25)|(50)|(5)|(75)|(0)|(00))?$"
         message="You must get a numeric total for Total Calculated Units. Correct the error in the page and press save."><P>
      <cfelse>
      <cfinput name="TotalUnitsParCalc" required="yes" bindonload="yes" readonly="yes"
      bind="cfc:bus.common.diag2TotalCalc.getCalcs({StartDate@change},{EndDate@change},{CalcRow@change},{row1value1@keyup},{row1value2@keyup} ,{row1value3@keyup},{row2value1@keyup},{row2value2@keyup},{row3value1@keyup},{row3value2@k eyup},{UnitMultiplier@keyup})"
          size="60" validate="regular_expression" pattern="^\d*\.?((25)|(50)|(5)|(75)|(0)|(00))?$"
         message="You must get a numeric total for Total Calculated Units. Correct the error in the page and press save."><P>

      </cfif>


      <cfif #getFrequencyList.StateApproval# eq '1'>
      <cfinput name="myLimit" id="myLimit" type="hidden"  value="" bind="cfc:bus.common.diag2TotalCalc.getLimits({TotalUnitsParCalc@change},{UnitLimit@keyup},{OverLimitApproval@change})" bindonload="no" validate="integer" range="1" message="You have entered too many units. Adjust calculations.">
      <cfelse>
      <cfinput name="myLimit" id="myLimit" type="hidden"  value="" bind="cfc:bus.common.diag2TotalCalc.getLimits({TotalUnitsParCalc@change},{UnitLimit@keyup})" bindonload="no" validate="integer" range="1" message="You have entered too many units. Adjust calculations.">

      </cfif>


      </td></tr>

       

      <tr><td align="center"> </td></tr>

      <tr><td align="center">
      <cfinput type="Submit" value="Save" name="Save"> </td></tr>
      </table>
       </td></tr></table>
      </cfform></cfoutput></cfajaximport>