1 Reply Latest reply on Dec 14, 2006 4:38 PM by Newsgroup_User

    check box value.

    emmim44 Level 1
      Hola fellow programmers.
      This code is driving me wal nut..I am trying insert the data into a db but somehow it is not swicthing btw v1 and v2 variables. Form.occ is dynamically populated checkboxes and Form.Vr12H8H is dynamically populated select boxes..
      any help willl be app..


      =====================

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Untitled Document</title>
      <link href="css/main.css" rel="stylesheet" type="text/css">
      <script language="JavaScript" type="text/javascript" src="js/main.js"></script>
      <style type="text/css">
      <!--
      .style1 {font-family: Arial, Helvetica, sans-serif}
      .style3 {
      font-family: Arial, Helvetica, sans-serif;
      font-size: 15px;
      font-weight: bold;
      }
      .style4 {
      font-size: 14px;
      font-weight: bold;
      color: #FF9933;
      }
      .style6 {font-size: 12px}
      -->
      </style>
      </head>

      <body>


      <CFQUERY NAME="SingleQuery" DATASOURCE="#FormVector#">
      select genbid_assignmentinfo.facname
      , genbid_assignmentinfo.facsch
      , genbid_bidresult.lastname
      , genbid_bidresult.firstname
      , genbid_bidresult.homefac
      , genbid_assignmentinfo.facspot
      , genbid_assignmentinfo.facid

      from genbid_assignmentinfo
      left
      join genbid_bidresult
      on genbid_bidresult.facsch = genbid_assignmentinfo .facsch
      and genbid_bidresult.facname = genbid_assignmentinfo .facname
      and genbid_bidresult.factype = 'SGT'
      order
      by genbid_assignmentinfo .facname
      , genbid_assignmentinfo .facsch
      , genbid_bidresult.lastname
      , genbid_bidresult.firstname
      </CFQUERY>


      <cfquery name="gethomefac" datasource="#FormVector#">
      select facid,facname
      from genbid_facility

      order by facname
      </cfquery>



      <form method="post">
      <table width="650px" border="0" align="center" cellpadding="2" cellspacing="2" class="graytableborder">

      <CFOUTPUT QUERY="SingleQuery" GROUP="facname">

      <tr>
      <td height="78" align="center" valign="middle" bgcolor="##CCCCCC"><span class="style3">#facname#</span></td>
      <CFOUTPUT GROUP="facsch">
      <td align="left" valign="top"><span class="style1"><span class="style4">#facsch#</span><br />
      <span class="style6">

      <cfset i=0>

      <cfif #firstname# neq "">
      <cfoutput>

      <input type="checkbox" name="Occ" value="#facname#|#facsch#|#facid#|#i#<cfif facname eq "VR">|#homefac#</cfif>"><cfif facname eq "VR">#homefac#</cfif>- #firstname# #lastname#<br />

      <cfset i=i+1>
      </cfoutput>
      </cfif>


      <cfset fs=#facspot#-#i#>
      <cfloop index="b" from="1" to="#fs#">
      <input type="checkbox" name="Occ" value="#facname#|#facsch#|#facid#|#b##i#<cfif facname eq "VR"><cfif #homefac# neq "">|#homefac#</cfif></cfif>">

      <cfif facname neq "VR">
      Open Spot<br />
      <cfelse>
      <cfset fid=#facid#>
      <select name="Vr12H8H" >
      <option value=""></option>
      <cfloop query="gethomefac">
      <option value="#facname#">#facname#</option>
      </cfloop>
      </select><br />
      </cfif>

      </cfloop>
      </span></span>

      </td>


      </CFOUTPUT>

      </tr>
      <tr><td><hr size="0.5" noshade="noshade" color="##99CC00"/></td><td colspan="6"><hr size="0.5" noshade="noshade" color="##99CC00"/></td></tr>

      </CFOUTPUT>
      </table>
      <center><input type="submit" class="button" id="sb" name="sb" value="Submit"></center>

      </form>

      <cfif isdefined('Form.sb')>
      <cfif isdefined('Form.Occ') >
      <cfset v2=""><cfset v3="">
      <cfloop list="#Form.Occ#" index="f">

      <cfset v1=#listgetat(f,3,"|")#>


      <cfif #listlen(f,"|")# eq 5 >
      <cfset v2=#listgetat(f,5,"|")#>

      </cfif>
      <!---cfif #Form.Vr12H8H# neq "" and #v2# eq "">
      <cfset i=1>
      <cfset v3=#listgetat(Form.Vr12H8H,i)#>
      <cfset i=i+1>
      </cfif--->

      <cfoutput>#v3# v2:#v2#</cfoutput><cfabort>
      <cfquery name="InsertD" datasource="#FormVector#">
      insert into genbid_assignmenttemp
      (facid,spot,homefac,status,tid)
      values(
      '#v1#',
      1,
      <cfif v2 neq "">'#v2#',<cfelse>'#v3#',</cfif>
      'Y',
      genbid_assignmenttempseq.nextval
      )
      </cfquery>



      </cfloop>


      </cfif>



      </cfif>


      </body>
      </html>


        • 1. Re: check box value.
          Level 7
          Not exactly sure this is what you are asking but....
          With standard check boxes you need to have a default value on the page you
          are submitting to since if it is unchecked that form field does not even
          exist. With standard checkbox / input fields this is an easy way of check or
          uncheck dynamically.


          <input name="checkboxname" type="checkbox" value="checkboxvalue"<cfif
          myfield is "Checked"> checked</cfif>>


          "emmim44" <webforumsuser@macromedia.com> wrote in message
          news:els2d0$j0n$1@forums.macromedia.com...
          > Hola fellow programmers.
          > This code is driving me wal nut..I am trying insert the data into a db but
          > somehow it is not swicthing btw v1 and v2 variables. Form.occ is
          > dynamically
          > populated checkboxes and Form.Vr12H8H is dynamically populated select
          > boxes..
          > any help willl be app..
          >
          >
          > =====================
          >
          > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          > " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
          > <html xmlns=" http://www.w3.org/1999/xhtml">
          > <head>
          > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
          > <title>Untitled Document</title>
          > <link href="css/main.css" rel="stylesheet" type="text/css">
          > <script language="JavaScript" type="text/javascript"
          > src="js/main.js"></script>
          > <style type="text/css">
          > <!--
          > .style1 {font-family: Arial, Helvetica, sans-serif}
          > .style3 {
          > font-family: Arial, Helvetica, sans-serif;
          > font-size: 15px;
          > font-weight: bold;
          > }
          > .style4 {
          > font-size: 14px;
          > font-weight: bold;
          > color: #FF9933;
          > }
          > .style6 {font-size: 12px}
          > -->
          > </style>
          > </head>
          >
          > <body>
          >
          >
          > <CFQUERY NAME="SingleQuery" DATASOURCE="#FormVector#">
          > select genbid_assignmentinfo.facname
          > , genbid_assignmentinfo.facsch
          > , genbid_bidresult.lastname
          > , genbid_bidresult.firstname
          > , genbid_bidresult.homefac
          > , genbid_assignmentinfo.facspot
          > , genbid_assignmentinfo.facid
          >
          > from genbid_assignmentinfo
          > left
          > join genbid_bidresult
          > on genbid_bidresult.facsch = genbid_assignmentinfo .facsch
          > and genbid_bidresult.facname = genbid_assignmentinfo .facname
          > and genbid_bidresult.factype = 'SGT'
          > order
          > by genbid_assignmentinfo .facname
          > , genbid_assignmentinfo .facsch
          > , genbid_bidresult.lastname
          > , genbid_bidresult.firstname
          > </CFQUERY>
          >
          >
          > <cfquery name="gethomefac" datasource="#FormVector#">
          > select facid,facname
          > from genbid_facility
          >
          > order by facname
          > </cfquery>
          >
          >
          >
          > <form method="post">
          > <table width="650px" border="0" align="center" cellpadding="2"
          > cellspacing="2" class="graytableborder">
          >
          > <CFOUTPUT QUERY="SingleQuery" GROUP="facname">
          >
          > <tr>
          > <td height="78" align="center" valign="middle" bgcolor="##CCCCCC"><span
          > class="style3">#facname#</span></td>
          > <CFOUTPUT GROUP="facsch">
          > <td align="left" valign="top"><span class="style1"><span
          > class="style4">#facsch#</span><br />
          > <span class="style6">
          >
          > <cfset i=0>
          >
          > <cfif #firstname# neq "">
          > <cfoutput>
          >
          > <input type="checkbox" name="Occ"
          > value="#facname#|#facsch#|#facid#|#i#<cfif facname eq
          > "VR">|#homefac#</cfif>"><cfif facname eq "VR">#homefac#</cfif>-
          > #firstname#
          > #lastname#<br />
          >
          > <cfset i=i+1>
          > </cfoutput>
          > </cfif>
          >
          >
          > <cfset fs=#facspot#-#i#>
          > <cfloop index="b" from="1" to="#fs#">
          > <input type="checkbox" name="Occ"
          > value="#facname#|#facsch#|#facid#|#b##i#<cfif facname eq "VR"><cfif
          > #homefac#
          > neq "">|#homefac#</cfif></cfif>">
          >
          > <cfif facname neq "VR">
          > Open Spot<br />
          > <cfelse>
          > <cfset fid=#facid#>
          > <select name="Vr12H8H" >
          > <option value=""></option>
          > <cfloop query="gethomefac">
          > <option value="#facname#">#facname#</option>
          > </cfloop>
          > </select><br />
          > </cfif>
          >
          > </cfloop>
          > </span></span>
          >
          > </td>
          >
          >
          > </CFOUTPUT>
          >
          > </tr>
          > <tr><td><hr size="0.5" noshade="noshade" color="##99CC00"/></td><td
          > colspan="6"><hr size="0.5" noshade="noshade" color="##99CC00"/></td></tr>
          >
          > </CFOUTPUT>
          > </table>
          > <center><input type="submit" class="button" id="sb" name="sb"
          > value="Submit"></center>
          >
          > </form>
          >
          > <cfif isdefined('Form.sb')>
          > <cfif isdefined('Form.Occ') >
          > <cfset v2=""><cfset v3="">
          > <cfloop list="#Form.Occ#" index="f">
          >
          > <cfset v1=#listgetat(f,3,"|")#>
          >
          >
          > <cfif #listlen(f,"|")# eq 5 >
          > <cfset v2=#listgetat(f,5,"|")#>
          >
          > </cfif>
          > <!---cfif #Form.Vr12H8H# neq "" and #v2# eq "">
          > <cfset i=1>
          > <cfset v3=#listgetat(Form.Vr12H8H,i)#>
          > <cfset i=i+1>
          > </cfif--->
          >
          > <cfoutput>#v3# v2:#v2#</cfoutput><cfabort>
          > <cfquery name="InsertD" datasource="#FormVector#">
          > insert into genbid_assignmenttemp
          > (facid,spot,homefac,status,tid)
          > values(
          > '#v1#',
          > 1,
          > <cfif v2 neq "">'#v2#',<cfelse>'#v3#',</cfif>
          > 'Y',
          > genbid_assignmenttempseq.nextval
          > )
          > </cfquery>
          >
          >
          >
          > </cfloop>
          >
          >
          > </cfif>
          >
          >
          >
          > </cfif>
          >
          >
          > </body>
          > </html>
          >
          >
          >
          >