Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

dynamic drop down menu with input boxes

$
0
0

Hi everyone. I have a select box with part numbers that you choose first, and depending on which part number you choose, some input boxes display to enter measurements into. Then you click Submit and it outputs the info. into a table that has some calculations it does first. This works just fine if I use just one input box for each part number. It even works when I have 2 input boxes. If I go through and do everything the first time, it works just fine. The problem is when I try to choose a different part number, I get an error. It's saying that "" can't be converted to a number on my X value. I'm assuming it would say the Y Value too if it would get that far. Does anyone know why this is happening or how to fix this? Here's my code:

 

<cfif NOT isDefined("form.submit")>

 

<cfif isDefined('form.PartNumber')>

<cfset page.select_Part = form.PartNumber>

</cfif>

 

<cfif isDefined('form.X')>

<cfset page.select_X = form.X>

</cfif>

 

<cfif isDefined('form.Y')>

<cfset page.select_Y = form.Y>

</cfif>

 

</cfif>

 

<div align="center">

<table width="650" cellpadding="3" cellspacing="10" border="0">

 

<cfoutput>

  <cfform method="post" name="DropDown">

 

<tr>

<td align=right class="grayfaqanswers">Shin-Etsu Part Number:</td>

<td align=left>

 

    <select name="PartNumber" class="formboxElastomer" required="required" onchange="this.form.submit()">

    <option selected value="">Part Number</option>

    <option value="MT0.1Px50x50x0.75T" <cfif isDefined('page.select_Part') and PartNumber Is"MT0.1Px50x50x0.75T">selected</cfif>>MT0.1Px50x50x0.75T</option>

    <option value="MT4x0.05Px50x50x0.5T" <cfif isDefined('page.select_Part') and PartNumber Is"MT4x0.05Px50x50x0.5T">selected</cfif>>MT4x0.05Px50x50x0.5T</option>

  </select>

 

    </td>

</tr>

 

<cfif isDefined('page.select_Part') and PartNumber Is"MT0.1Px50x50x0.75T">

<tr>

<td class="grayfaqanswers" align="right">Xmm:</td>

<td>

<cfinput name="X" type="text" validate="integer" message="Please enter only a whole number for the Xmm value!" range = "1,50" validateAt="onSubmit" required="yes" class="formboxElastomer" size="6">

</td>

</tr>

 

<tr>

<td class="grayfaqanswers" align="right">Ymm:</td>

<td>

<cfinput name="Y" type="text" validate="integer" message="Please enter only a whole number for the Ymm value!" range = "1,50" validateAt="onSubmit" required="yes" class="formboxElastomer" size="6">

</td>

</tr>

</cfif>

 

<cfif isDefined('page.select_Part') and PartNumber Is"MT4x0.05Px50x50x0.5T">

<tr>

<td class="grayfaqanswers" align="right">Xmm:</td>

<td>

<cfinput name="X" type="text" validate="integer" message="Please enter only a whole number for the Xmm value!" range = "1,50" validateAt="onSubmit" required="yes" class="formboxElastomer" size="6">

</td>

</tr>

 

<tr>

<td class="grayfaqanswers" align="right">Ymm:</td>

<td>

<cfinput name="Y" type="text" validate="integer" message="Please enter only a whole number for the Ymm value!" range = "1,50" validateAt="onSubmit" required="yes" class="formboxElastomer" size="6">

</td>

</tr>

</cfif>

 

<tr>

<td> </td>

</tr>

 

<tr>

<td> </td>

<td>

<cfinput name="SubmitElastomer" type="submit" onchange="this.form.submit()"  value="Update"> 

<cfinput name="Reset" type="reset" value="Reset">

 

</cfform>

</td>

</tr>

 

</table>

 

<!--- if the correct part number selection has been made, display the calculations with the appropriate sell price results --->

<cfif isDefined('page.select_Part') and isDefined('page.select_X') and isDefined('page.select_Y') and PartNumber Is"MT0.1Px50x50x0.75T">

 

<cfset Xmm = Int(50/#X#)>

<cfset Ymm = Int(50/#Y#)>

 

<table class="grayfaqanswers" id="moderntable">

 

<tr class="elastomerheader">

<td width=150 align="left">Part Number:</td>

<td>Xmm:</td>

<td>Ymm:</td>

</tr>

 

<tr><td colspan="6" valign="top" align="center"><hr></td></tr>

 

<tr>

<td width=150 align="left">#PartNumber#</td>

<td>#X#</td>

<td>#Y#</td>

</tr>

 

</table>

</cfif>

 

<!--- if the correct part number selection has been made, display the calculations with the appropriate sell price results --->

<cfif isDefined('page.select_Part') and isDefined('page.select_X') and isDefined('page.select_Y') and PartNumber Is"MT4x0.05Px50x50x0.5T">

 

<cfset Xmm = Int(50/#X#)>

<cfset Ymm = Int(50/#Y#)>

 

<table class="grayfaqanswers" id="moderntable">

 

<tr class="elastomerheader">

<td width=150 align="left">Part Number:</td>

<td>Xmm:</td>

<td>Ymm:</td>

</tr>

 

<tr><td colspan="6" valign="top" align="center"><hr></td></tr>

 

<tr>

<td width=150 align="left">#PartNumber#</td>

<td>#X#</td>

<td>#Y#</td>

</tr>

 

</table>

 

</cfif>

</cfoutput>

 

Thanks for your help.

Andy


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>