Happy Monday,

I'm building a form in CF and Javascript. With the quantity fields,
(they are dynamically generated - the name is actually #SKU#_QTY) if the
person enters a number that is larger than the available inventory for
that item, I'd like to display an alert that tells them that they cannot
enter that amount.

I assume that I could do something like this:

<!--- generates the form field --->
<cfoutput query = whatever>
<form method = post action=whatever.cfm>

<input type = "text" name = "#SKU#_QTY"
       onBlur = "checkfield(this,#Inventory#)">

</form>
</cfoutput>

Now the part I find somewhat un-understandable is how to call Inventory
in this. I assume that when you could do something like this:

<SCRIPT LANGUAGE="JavaScript">
<!--
function checkInput(QTY,Inventory) 
{
this.QTY = QTY;
Inventory = Inventory;

  if (QTY > Inventory) 
  {
    alert("Current Stock only has " + Inventory + ". Please choose a
different amount.");
    field.focus();
    field.select();
    return false;
  } else 
    {
     return true; 
    }
}

// -->
</SCRIPT>

However, of course this doesn't work.
Any suggestions that you would have would be most appreciated.

thanks,
larry

-- 
Larry C. Lyons
ColdFusion/Web Developer
EBStor.com
8870 Rixlew Lane, Suite 201
Manassas, Virginia 20109-3795
tel: (703) 393-7930 x253
fax: (703) 393-2659
http://www.ebstor.com
http://www.pacel.com
email: [EMAIL PROTECTED]

Chaos, panic, and disorder - my work here is done.
--

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to