0

I have a big doubt about Carttrob.

Here a simple form code:

 {exp:cartthrob:add_to_cart_form    allow_user_price="yes" return="{template_group}/view_cart"}

                    <input name="price" autocomplete="false"                       
                          type="number"placeholder="" />


                        <label for="15">15</label>
                        <input type="radio" name="price" value="15" id="15"/>

                        <label for="30">30</label>
                        <input  type="radio" name="price" value="30" id="30"/>

                        <label for="45">45</label>
                        <input  type="radio" name="price" value="45" id="45"/>


                <label class="clear">
                    <textarea placeholder="None" name="item_options[donation_note]" ></textarea>
                </label>
                <button type="submit" class="button">Add to Cart</button>

    {/exp:cartthrob:add_to_cart_form}

if enter image description here is placed before the radio buttons block code <input type="radio" name="price" value="x" id="x"/>

it works fine, because in the In the mysite/donate/view_cart page, appears:

enter image description here

but if enter image description here is placed after the block code <input type="radio" name="price" value="x" id="x"/>

here the simple form code modified, the input type number is placed after.

 {exp:cartthrob:add_to_cart_form    allow_user_price="yes" return="{template_group}/view_cart"}



                            <label for="15">15</label>
                            <input type="radio" name="price" value="15" id="15"/>

                            <label for="30">30</label>
                            <input  type="radio" name="price" value="30" id="30"/>

                            <label for="45">45</label>
                            <input  type="radio" name="price" value="45" id="45"/>

                        <input name="price" autocomplete="false"                       
                              type="number"placeholder="" />



                    <label class="clear">
                        <textarea placeholder="None" name="item_options[donation_note]" ></textarea>
                    </label>
                    <button type="submit" class="button">Add to Cart</button>

        {/exp:cartthrob:add_to_cart_form}

The <input type="radio" name="price" value="x" id="x"/> buttons are not processed, In the mysite/donate/view_cart appears:enter image description here

So the input radio buttons are not processed if they are placed before the input type="number. It appears R$0.00. Only the input type="number is processed, the radio buttons not.

Why the radio buttons are processed only if they are placed after the input type="number ? A process priority problem ?

0

Perhaps is not the better solution, but thanks to the Source Ordering (from the Zurb Foundation framework) the order columns could be shifted.

                <fieldset class="small-8 small-push-4 columns">
                                    <input name="price" class="" style="width: 9rem; margin-bottom: 0;"
                                           onkeypress="return isNumeric(event)"
                                           oninput="maxLengthCheck(this)"
                                           autocomplete="false"
                                           placeholder = "Livre"
                                           type = "number"
                                           min = "1"
                                           max = "9999999" />
                                </fieldset>

                    <fieldset id="defined_price" class="small-4 small-pull-8 columns">
                                    <!--<label for="doar_{valor_1}">{valor_1}</label>-->
                                    <input name="price"  type="radio" value="{valor_1}" id="{valor_1}" id="doar_{valor_1}"><label for="{valor_1}">{valor_1}</label>
                                    <input name="price" type="radio"  value="{valor_2}" id="{valor_2}" id="doar_{valor_2}"><label for="{valor_2}">{valor_2}</label>
                                    <input name="price" type="radio"  value="{valor_3}" id="{valor_3}" id="doar_{valor_3}"><label for="{valor_3}">{valor_3}</label>
                    </fieldset>

The two display fieldsets are inverted, so the input type="number" is placed before the radio input, but thanks to the Zurb Foundation Grid css command.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.