| Asigning value to text box if used
|
dave_mck

msg:4172570 | 1:50 am on Jul 19, 2010 (gmt 0) | I'm trying to make an ordering page where my clients would enter in a image code "L5648" If a code was entered into a form text box, it would save the image code value as well assign a new value of $6.00 so further down the page, the form would calculate the order total. So. if 4 image codes were entered I would have 4 values of "6.00" each. Is this possible? [mckittricks.org...] (See the "Unaltered images burned to cd") Thanks in advance. Dave. Site is in test mode so play if you would like.
|
Major_Payne

msg:4173168 | 3:19 am on Jul 20, 2010 (gmt 0) | Not with HTML. HTML is a static language. You would need a server-side scripting language. Might look into installing an eCommerce package which has an "Add to Cart" function. Alternative is to check PayPal and see what they provide for a Cart function on a web site. Ron
|
tedster

msg:4173191 | 6:19 am on Jul 20, 2010 (gmt 0) | Welcome to the forums, Dave. Major_Payne speaks the truth!
|
dreamcatcher

msg:4173869 | 7:34 am on Jul 21, 2010 (gmt 0) | I`m not sure he`s asking about a cart option, but rather a way for the form to total itself up automatically before the pay button is clicked? Look into javascript/ajax. dc
|
dave_mck

msg:4174131 | 3:54 pm on Jul 21, 2010 (gmt 0) | I've been working on some code someone gave me on another forum but can't quite get it. I think I'm having a problem striping out the first letter in the "cd" box. var re = substr("cd"+c, -4); The boxes will be populated with image codes like: L5487, S5487, D5487 and T6542. Sorry if this should be in the java section, I started out with thinking it was a html format problem.
<html> <head> <script type="text/javascript"> function getCdCost( ) { var re = substr("cd"+c, -4); var form = document.selectionForm; var count = 0; for ( var c = 1; c < 9999; ++c ) { var fld = form.elements["cd"+c]; if ( fld == null ) break; // out of loop when no more var val = fld.value.replace(/\s/g,""); // zap spaces if ( val != "" ) { if ( re.test( val ) ) ++count; } else { alert( "Invalid L number: " + fld.value ); } } var cost = 0; if ( count > 0 ) cost = 23 + 6 * ( count - 1 ); } </script> </head> <body>
<form method="POST" name="selectionForm" action="sendform.php"> <input type="text" name="cd1" size="3" maxlength="5" onchange="getCdCost();this.form.SUBMIT.focus();"><br/> <input type="text" name="cd2" size="3" maxlength="5" onchange="getCdCost();this.form.SUBMIT.focus();"><br/> <input type="text" name="cd3" size="3" maxlength="5" onchange="getCdCost();this.form.SUBMIT.focus();"><br/> <input type="text" name="cd4" size="3" maxlength="5" onchange="getCdCost();this.form.SUBMIT.focus();"><br/> <br/> <input type="text" name="total" readonly> <br/> <input type="submit" value="Submit"> </form> </body> </html>
|
|
|