Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
Hi,

anybody know if there's a solution to Couchified this:

<select>
<option data-price="0"> Extra language </option>
<option data-price="350" data-label="One language 2"> One language 350 $</option>
<option data-price="700" data-label="Two languages 2"> Two languages 700 $ </option>
<option data-price="1050" data-label="Three languages 2"> Three languages 950 $ </option>
</select>

I need to set 'data-price' and 'data-label' instead of only the regular 'value' in the opt_values...
Maybe @cheesypoof will have some idea about this ..
He already has!
I suppose this solution has helped a lot of people, especially I used it many times: viewtopic.php?f=4&t=8328&p=15233#p15228
In my case it doesn't work because I need
data-price="xxxx"
and
data-label="xxxx"
to persist for the JS to use it as variables at http://www.paolowebdesign.com/services/

It works with regular markup, but couch can't retain the variable if the page is refreshed.
It works to send the info by mail though...
Paolo, is the problem that the selected value isn't retained after submitting your form?

If so, I think the following should work:
Code: Select all
<cms:hide>
   <cms:input label='Extra language(s)' name='extra_langs' opt_selected='0' opt_values='-- Extra language(s) --=0 | One language=1 | Two languages=2 | Three languages=3' type='dropdown'/>
</cms:hide>

<cms:set my_extra_langs = "<cms:gpc method='post' var='extra_langs'/>"/>

<select name="extra_langs">
   <option <cms:if "<cms:not my_extra_langs/>">selected</cms:if> value="0" data-price="0">-- Extra language(s) --</option>
   <option <cms:if my_extra_langs == '1'>selected</cms:if> value="1" data-price="350" data-label="One language 2">One language</option>
   <option <cms:if my_extra_langs == '2'>selected</cms:if> value="2" data-price="700" data-label="Two languages 2">Two languages</option>
   <option <cms:if my_extra_langs == '3'>selected</cms:if> value="3" data-price="1050" data-label="Three languages 2">Three languages</option>
</select>
Hi Cheesy,
actually it doesn't work.
If I let the value: value="2' ...
The number remains in the basket but I get an extra Two language 2
Total:
$700.00
Details:
Two languages 2: $700
Two languages 2: $2

And if I remove the value, it doesn't retain the variable after an error and page refresh.

But don't sweat it, I removed the dropdown, it screwed my responsive design, and since it's an old bootstrap 2...

Thanks anyway,
Paolo E.
6 posts Page 1 of 1