Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

145
Views
Looking to take Quantity from a text input and use OnClick="location.href" to push information to new page

Currently I am using this to submit a quantity of 1 product to my cart page with a simple Onclick add to cart button.

<td class="data_cell dataFontColor">
                <label onClick="location.href='cart/?PartNo=#NPart#&Qty=1'">Add to 
Cart</label></td>
            <td class="data_cell dataFontColor">
                 <cfif IsDefined ("getPrice2.Price") AND getPrice2.Price eq "">

I am trying to implement a text box to submit any quantity the user wants, but on submit the page moves but nothing is added to cart. I know it's something wrong with the Qty= in the OnClick, but can't seem to figure it out. Any help would be appreciated!

<td class="data_cell dataFontColor">
            <td><input type="text" name="Qty" size="4" value= "Qty" maxlength="9"/></td>
            <td class="data_cell dataFontColor">
            <label onClick="location.href='shop/?PartNo=#NPart#&Qty=#Trim (Qty)#'">Add to 
Cart</label></td>
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The reason this is not working is because you can't do what you're attempting using ColdFusion which processes the page server-side. User typed inputs are processed client-side.

First, I would add an id attribute to your input tag.

<input type="text" id="Qty" name="Qty" size="4" value= "Qty" maxlength="9"/>

Once your input has an ID, now you can now extract the value client-side using JavaScript.

<label onClick="location.href='shop/?PartNo=#NPart#&Qty="+document.getElementById("Qty").value.trim()>Add to Cart</label>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!