P
P
Philip Gavrilov2016-03-20 15:10:53
MODX
Philip Gavrilov, 2016-03-20 15:10:53

How to filter out unnecessary input value in email (modx revo + formit)?

There is the following construction: there are two products that can be selected by checkboxes. When choosing a product, with the help of js, an additional input appears, where you need to specify its quantity (default is "1")
4d2c79d86ab4fee38097676b52ec2957.jpeg
Using the formit plugin, I implemented it this way:



<!-- Ручка -->
<input type="hidden" name="pen[]" value="">
<input type="checkbox" id="pen" name="pen[]" value="Ручка"  
 onclick="showHide('pen-input');" >
<label for="pen">Ручка</label>

<!-- Всплывающий инпут Ручки -->
<div  id="pen-input" style="visibility:hidden">
<input type="text"  id="pen-number" name="pen-number" value="1">
 </div>


<!-- Товар-2 -->
<input type="hidden" name="pencil[]" value="">
<input type="checkbox" id="pencil" name="pencil[]" value="Карандаш"  
 onclick="showHide('pencil-input');" >
<label for="pencil">Карандаш</label>

<!-- Всплывающий инпут Карандаша -->
<div  id="pencil-input" style="visibility:hidden">
<input type="text"  id="pencil-number" name="pencil-number" value="1">
 </div>

The chunk describing the letter from the server is as follows:
Покупатель выбрал:<br /><br />

As a result, if the buyer has chosen both goods and indicated their quantity (default is "1"), then the type of letter is as follows: The
buyer has chosen:
Pen - 1
Pencil - 1

it leaves a counter with "1" by default: The
buyer chose:
Pen - 2
- 1

I can't figure out how to avoid getting the amount of unselected item in the email.
In which direction to dig, how to be?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
Philip Gavrilov, 2016-03-21
@Filgavrilov

Solution from Pavel Romanov:
In a chunk:

D
display: block, 2016-03-20
@qork

Crutch variant, for the normal organization it is necessary to smoke to dock.

Покупатель выбрал:<br />  

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question