Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Coldfusion javascript form control to + and - the value in an <input>

Participant ,
Jun 13, 2010 Jun 13, 2010

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.

TOPICS
Getting started
798
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 13, 2010 Jun 13, 2010
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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2010 Jun 14, 2010

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 14, 2010 Jun 14, 2010

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jun 14, 2010 Jun 14, 2010

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 ?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Jun 14, 2010 Jun 14, 2010
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources