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

Changing values based on input

Participant ,
Mar 13, 2008 Mar 13, 2008
I have a form with a input field labeled Single Qty and a field labeled Unit of Measure, which defaults to EACH.
We have addes a new field labeled Multiple Lots Qty.

What needs to happen now is that if an entry is made in the Single Qty field, the Unit of Measure remains EACH. If an entry is made in the Multiple Lots Qty field, then the Unit of Measure should change to LOTS.

How do I do this ?

Thanks
416
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 ,
Mar 14, 2008 Mar 14, 2008
Either take away the form field that has the unit of measure, or just have one text box for quanity and let the user decide what the unit is.
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
Explorer ,
Mar 14, 2008 Mar 14, 2008
Write an if statement?

<cfif len(form.SingleQty)>
Your logic... Unit of measure = #EACH#
<cfelseif len(form.MultipleLotsQty)>
your logic.. Unit of measure = #LOTS#
</cfif>
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 ,
Mar 14, 2008 Mar 14, 2008
I have <input type="text" name="unit_of_measure" value="Each">, so when the form is first displayed, each is predisplayed in the unit of measure field. If I input a value for single qty, the unit of measure each is unchanged and written to the database.

If I input a value into the multiple lots qty, I want the unit of measure to be replaced by Lots, in the unit of measure field, before the form is submitted.

I know the unit of measure can be determined after the form is submitted, but I need it to display on the form before it is submitted, if possible.
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 ,
Mar 15, 2008 Mar 15, 2008
Anybody have any cf or javascript code/examples on how to do this ?

I need the unit of measure value changed on the screen, from Each to Lots, if they enter a value in the lots field.

This needs to be done prior to form submission.

Thanks
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
Explorer ,
Mar 17, 2008 Mar 17, 2008
LATEST
"If I input a value into the multiple lots qty, I want the unit of measure to be replaced by Lots, in the unit of measure field, before the form is submitted.

I know the unit of measure can be determined after the form is submitted, but I need it to display on the form before it is submitted, if possible. "

If you want to change the values "before" the form is submitted, you need to use javascript..

If you dont understand how to use document.myform.formname.value, then I would reccommend learning some basic javascript before you start writing code with it.
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