Copy link to clipboard
Copied
So whenever you output the contents of the shoppingCart on screen, you provide an <input> for the user to alter QTY if necessary on each row.
For my v2.0 shopping cart, I'm going to employ a ram based structure to hold the cart. Is there a javascript control that can dynamically change the value in a form's <input> tag ? For example on each row of the RAM based cart, I'd like + and - controls that can change the QTY value in RAM. Is this possible ?
Then I could do without the update cart button.
Copy link to clipboard
Copied
Is there a javascript control that can dynamically change the value in a form's <input> tag ?
Yes there is.
You should be able to suss it out with a small bit of investigation/research/experimentation. I recommend googling "form javascript" as a good place to start.
--
Adam
Copy link to clipboard
Copied
I did go and look on the web first, but couldn't get the correct search term - just lots of form related stuff but nothing to do with what I needed.
I'll have another look.
So from your comments, it IS possible ... which is great!
Copy link to clipboard
Copied
I did go and look on the web first, but couldn't get the correct search term - just lots of form related stuff but nothing to do with what I needed.
If I just google for your exact question "Is there a javascript control that can dynamically change the value in a form's <input> tag", the second match gives you most of the info you need!
😕
--
Adam
Copy link to clipboard
Copied
OK, that's great. I now can see how to influence a form <input> value.
So is it possible, through one of these javascript forms (+ and -) to directly affect a coldfusion variable ?
What I'm hoping to do is abandon the form completely, storing everying in a session based structure ?
Copy link to clipboard
Copied
Since ColdFusion runs on a server and no browser in the world can understand CFML. You are rather out of luck to eliminate the "form".
And NO JavaScript can not directly affect a coldfusion variable. JavaScript runs on the client, ColdFusion runs on the server and never can the two meet.
JavaScript can submit a request along with one or more key-value pairs TO the server to have a piece of CFML code run. JavaScript can make this request behind the scenes (commonly called AJAX). But the JavaScript variables and the ColdFusion variables are in two different memories on two different commputers that could be thousands of miles apart.