Forums

Converting a custom html form in chronoforms

capples3 03 Jun, 2009
Hi All,

I have a working javascript form which code is here.

<script language="JavaScript">
<!--

function cbs_recalc()
{
	var nummemb =0, numnonmem = 0, totalattending = 0;
	var pricemem=17.49, pricenonmem=28.09;

	if (document.form1.noofmembers.value =='')
	{
		document.form1.noofmembers.value = '0';
	}
	if (document.form1.noofnonmembers.value =='')
	{
		document.form1.noofnonmembers.value = '0';
	}
	
	nummemb = parseInt(document.form1.noofmembers.value);
	numnonmem = parseInt(document.form1.noofnonmembers.value);
	totalattending = nummemb + numnonmem;

	var MyEvent = document.form1.event;
	var MyValue = (document.form1.event.options[MyEvent.selectedIndex].value).substr(0,((document.form1.event.options[MyEvent.selectedIndex].value).indexOf('_')));

	if ((MyValue=='bn') || (MyValue=='AJ9-37') || (MyValue=='ALM-A6') || (MyValue=='ALU-H')){
		pricemem = 10.60;
		pricenonmem = 21.20;
	}else if ((MyValue=='nah') || (MyValue=='ALV-9H') || (MyValue=='AJ9-3Y') || (MyValue=='AJ9-3L')  || (MyValue=='AKP-6R') || (MyValue=='ALK-13') || (MyValue=='ALU-H')  || (MyValue=='ALV-3W')){
	  pricemem = 17.49;
	  pricenonmem = 28.09;	  
	}
	
	//free events
	if(MyValue == 'ALW-18' || MyValue == 'ALV-9U' || MyValue == 'AM7-3E' || MyValue == 'AM9-ET' || MyValue == 'AM9-EW' || MyValue == 'AMD-H' || MyValue =='AMM-5D' || MyValue == 'AMM-8Y' || MyValue == 'AMP-11' || MyValue=='AMP-1X')
	{
	   document.form1.noofnonmembers.value = "0";
	   document.form1.price.value = '$0 Free';
	}
	
	document.form1.price.value = '$' + ((nummemb*pricemem) + (numnonmem*pricenonmem)).toFixed(2);
	
	
	return true;

}
-->
</script>
</head>


<body>
<td valign="top"><img src="images/spacer.gif" width="610" height="1" border="0" /><br />
	 <div align="center"><img src="images/eventformheader.jpg" width="218" height="58">
		<table width="590">
              <tr> 
                <td align="center">
      <form name="form1" method="post" action="http://www.bonnieviewinn.com/cgi-bin/formmail/chamber.cgi" onsubmit="return cbs_recalc();">
        <div align="center">
          <input type="hidden" name="recipient" value="info@whitbychamber.org">
          <input type="hidden" name="subject" value="Event Form From Website">
          <input type="hidden" name="redirect" value="http://www.whitbychamber.org/eventsthanks.asp">
          <input type="hidden" name="required" value="email">
		  <input type="hidden" name="pricemembers" value="" />
		  <input type="hidden" name="pricenonmembers" value="" />
          <table width="75%" border="0" cellspacing="4" cellpadding="0">
            <tr>
              <td width="50%" align="right" bgcolor="#446592">
                <div align="right"><font face="Arial" color="#FFFFFF">Event : </font></div>
              </td>
              <td width="50%"> <font face="Arial">
                <select name="event" onchange="cbs_recalc();" style="width: 400px">
                    <option value='bn_ - Durham Region Headquarters - June 18th_#06/18/09#' >* <?xml version="1.0" encoding="ISO-8859-1"?>
<span>Breakfast Networking - Durham Region Headquarters - June 18th</span>
</option>
                    
                    <option value='bn_' > <?xml version="1.0" encoding="ISO-8859-1"?>
<span>Annual Golf Tournament - June 9th</span>
</option>
                    
                   
                    
                    <option value='nah_Breakfast Networking - Durham Region Headquarters - June 18th_#06/18/09#' > <?xml version="1.0" encoding="ISO-8859-1"?>
<span>Breakfast Networking - Durham Region Headquarters - June 18th</span>
</option>
                    
                    <option value='bn_RedChair Branding - BUZZ MARKETING BOOT CAMP - June 23_#06/18/09#' > <?xml version="1.0" encoding="ISO-8859-1"?>
<span>RedChair Branding - BUZZ MARKETING BOOT CAMP - June 23</span>
</option>
                    
                    <option value='AMP-25_Networking After Hours - On The Rocks Oshawa - June 30th_#06/18/09#' > <?xml version="1.0" encoding="ISO-8859-1"?>
<span>Networking After Hours - On The Rocks Oshawa - June 30th</span>
</option>
                    
                </select>
                </font></td>
            </tr>
			 <tr>
              <td width="50%" align="right" bgcolor="#446592"><font face="Arial" color="#FFFFFF">Using Networking After Hours Pass:
                </font></td>
              <td width="50%"> <font color="#446592" face="Arial">Yes
                <input type="radio" name="after_hours_pass" value="Yes" />
                No
                <input type="radio" name="after_hours_pass" value="No" />
            	</font></td>
            </tr>	
            <tr>
              <td width="50%" align="right" bgcolor="#446592"><font face="Arial" color="#FFFFFF">Number
                Of Member Attendees: </font></td>
              <td width="50%">
                <input type="text" name="noofmembers" onblur="cbs_recalc();" value="0" />
              </td>
            </tr>
            <tr>
              <td width="50%" align="right" bgcolor="#446592"><font face="Arial" color="#FFFFFF">Number
                Of Non-Member Attendees: </font></td>
              <td width="50%">
                <input type="text" name="noofnonmembers" onblur="cbs_recalc();"  value="0" />
              </td>
            </tr>
			 <tr>
              <td width="50%" align="right" bgcolor="#446592"><font face="Arial" color="#FFFFFF">Additional Comments/Notes:
                </font></td>
              <td width="50%"> <font color="#446592" face="Arial">
				<textarea name="comments" style="width:400px;height:250px;"></textarea>
            	</font></td>
            </tr>
           <!-- <tr>
              <td width="50%" align="right" bgcolor="#446592"><font face="Arial" color="#FFFFFF">Are
                You A Member?: </font></td>
              <td width="50%"> <font face="Arial">
                <input type="checkbox" name="member" value="yes" />
                Yes</font></td>
            </tr> -->

            <tr>
              <td width="50%" align="right" bgcolor="#446592"><font face="Arial" color="#FFFFFF">Total <sup><font color="#FF0000">*</font></sup><font size="-1">(incl. GST)</font>:</font></td>
              <td width="50%">
                <input type="text" name="price" onblur="cbs_recalc();" onmouseover="cbs_recalc();"  value="$0.00" />
              </td>
            </tr>
			<!--<tr>
              <td colspan="2" align="left" bgcolor="#FFFFCC">
                <sup><font color="#FF0000">*</font></sup><font face="Arial" size="2" color="#003366"><strong>Please note that at this time you may only purchase a Sponsor's Table for our Networking After Hours events and our Breakfast Networking events.</strong></font>
              </td>
            </tr>-->
			<tr>
              <td colspan="2" align="left">
                <hr />
              </td>
            </tr>
			 <tr>
              <td colspan="2" align="left" bgcolor="#FFFFCC">
                <sup><font color="#FF0000">*</font></sup><font face="Arial" size="2" color="#003366"><strong>Please note that this total does not include the cost of the Sponsor's Table.</strong></font>
              </td>
            </tr>
            <tr>
              <td width="50%" align="right" bgcolor="#446592">
                <input type="submit" name="Submit" value="Submit" onclick="cbs_recalc();" />
              </td>
              <td width="50%">
                <input type="reset" name="Submit2" value="Reset" />
              </td>
            </tr>
          </table>
        </div>
      </form>
</td>
              </tr>
            </table>


I'm looking to convert this to a Chronforms form the problem I would have is with all the javascript in the form. Can ChronoForms support this form and how could I go about doing it.

Thanks
GreyHead 03 Jun, 2009
Hi capples3,

Please check FAQ9 from the menu above.

Bob
This topic is locked and no more replies can be posted.