Problems, need help? Have a tip or advice? Post it here.
8 posts Page 1 of 1
Hi, I've issue with repeatable region inside couch form tag.

My goal is to create simple quiz which is processed by couch and send via email. My code look like below:
Code: Select all
<cms:form action="" method="post" id="quiz-form" class="text-center">
          <cms:show_repeatable 'quiz_section' >
              <fieldset id="q<cms:show k_count />">
                <h5><cms:show quiz_title /></h5>
                <label>
                  <cms:input type="radio" value="q<cms:show k_count />-jowita" name="q<cms:show k_count />" />
                  Jowita
                </label>
                <label>
                  <cms:input type="radio" value="q<cms:show k_count />-mateusz" name="q<cms:show k_count />" />
                  Mateusz
                </label>
                <label>
                  <cms:input type="radio" value="q<cms:show k_count />-oboje" name="q<cms:show k_count />" />
                  Oboje
                </label>
              </fieldset>
            </cms:show_repeatable>
        </cms:form>


On frontend there is no input tag (just blank label). Without cms: prefix everything looks good (even with repeatable region).
What can I do in that particular case?
Hi,

Defining radio/checkbox/dropdown inputs requires (in Couch) the use of 'opt_values' param specifying ll the values.

I think you should find the following thread useful where we generate a form using repeatable regions -
viewtopic.php?f=8&t=7998

Hope it helps.
Hi,
I needed to use opt_values even for hard coded select options?
Yes. If you are using the Couch tag <cms:input> (or its counterpart <cms:editable>) to generate dropdown/radio/checkbox, then their syntax mandates the use of 'opt_values'.
Ok, now I am pretty confused.
Please take a look below
First of all I am outputing quiz_ID*yellow*( (on frontend it increasing for each repeatable region), then outputing the same var in value cms:input field. But now on frontend I am getting only first value stored in admin section*red*
Code: Select all
<cms:form action="" method="post" id="quiz-form" class="text-center">
          <cms:show_repeatable 'quiz_section' >
              <fieldset id="q<cms:show k_count />">
                <h5><cms:show quiz_title /></h5>
                <cms:show quiz_ID />
                <cms:input type="text" name="quiz_id" value="<cms:show quiz_ID />" />
                <cms:input type="radio" name="pytanie" opt_values="Jowita=Jowita | Mateusz=Mateusz | Oboje=Oboje " /><br />
               
              </fieldset>
            </cms:show_repeatable>
        </cms:form>

brave_2019-05-28_18-30-37.png
brave_2019-05-28_18-30-37.png (43.25 KiB) Viewed 1064 times


** So it looks like I can't increase opt_values using ex opt_values="Jowita=<cms:show k_count />Jowita | Mateusz=<cms:show k_count />Mateusz | Oboje=<cms:show k_count />Oboje " **
You are getting the first value because it is assigned to the input named quiz_id repeated 4 times with the same name. Always recheck generated HTML to spot errors like this.

Another hint - values inside the opt_values do not require repeating itself. It is okay to have it like this - opt_values="Jowita | Mateusz | Oboje"
trendoman wrote: You are getting the first value because it is assigned to the input named quiz_id repeated 4 times with the same name. Always recheck generated HTML to spot errors like this.


ok, so how can I generate inside repeatable region unique input field as using <cms:show k_count /> as unique field ID not working
Maybe you can start with a good explanation.. Always start with a. sample working HTML that needs couchifying b. attached php file with your attempt to code your variant of solution that would be easy to put into other people installation.
8 posts Page 1 of 1
cron