Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Until now I could outsmart the automatically generated html code for the input fields of type checkbox or radio like that:
Code: Select all
<div class="col-xs-12">
   <cms:input type="radio" name="gebaeudetyp" opt_values="" id="gebaeudetyp" class="ignore" />
   <div class="row g_div">
      <div class="col-xs-6 col-sm-3">
         <input id="gebaeudetyp0" type="radio" name="gebaeudetyp" value="Privathaus" />
         <label for="gebaeudetyp0" class="g_label"><img src="<cms:show k_site_link />/media/image/generator/gebaeudetyp_privat_1.jpg" class="g_image"><h4 class="g_image_label">Privathaus</h4></label>
      </div>
      <div class="col-xs-6 col-sm-3">
         <input id="gebaeudetyp1" type="radio" name="gebaeudetyp" value="Stockwerk-Eigentum" />
         <label for="gebaeudetyp1" class="g_label"><img src="<cms:show k_site_link />/media/image/generator/gebaeudetyp_stockwerk_2.jpg" class="g_image" alt=""><h4 class="g_image_label">Wohnung</h4></label>
      </div>
      <div class="col-xs-6 col-sm-3">
         <input id="gebaeudetyp2" type="radio" name="gebaeudetyp" value="Gewerbeobjekt" />
         <label for="gebaeudetyp2" class="g_label"><img src="<cms:show k_site_link />/media/image/generator/gebaeudetyp_gewerbe_3.jpg" class="g_image" alt=""><h4 class="g_image_label">Gewerbeobjekt</h4></label>
      </div>
      <div class="col-xs-6 col-sm-3">
         <input id="gebaeudetyp3" type="radio" name="gebaeudetyp" value="Anderes" />
         <label for="gebaeudetyp3" class="g_label"><img src="<cms:show k_site_link />/media/image/generator/weiss_nicht.jpg" class="g_image" alt=""><h4 class="g_image_label">Anderes</h4></label>
      </div>
   </div>
</div>


This worked because I simulated the output of the input tag as if I used opt_values="... | ... | ...", but actually leaving this option enpty: opt_values="".

Now I want to store the form in the db with DataBound Forms, not only send an e-mail. Unfortunately this is no longer possible, since either CouchCMS produces the input fields itself, or they are not stored.

Is there a Hack of CouchCMS that prevents Couch from generating the Code? I have specially styled checkbox and radio inputs that look like the attached image. It is not possible to use the generated code from Couch.

Attachments

The workaround would be to use *both* Couch inputs and HTML inputs together as shown here -
viewtopic.php?p=20156#p20156

Hope it helps.
Thanks for the tip!

I found another solution, based on http://www.couchcms.com/forum/viewtopic.php?f=4&t=8047. Based on the following definition of the editable:

Code: Select all
<cms:template title='Requests' executable='0' clonable='1'>
   <cms:editable type='checkbox' name='schwerpunkt' label='Schwerpunkt' required='0' opt_values='Energieeffizienz | Einbruchsicherheit | Schallschutz | Weiss nicht' />
</cms:template>


The form looks as follows:

Code: Select all
<cms:form
   masterpage='requests.php'
   mode='create'
   enctype='multipart/form-data'
   method='post'
   anchor='0'
   role='form'
   >
   <cms:if k_success >
      <cms:db_persist_form
         _invalidate_cache='0'
         schwerpunkt=frm_schwerpunkt
         _auto_title='1'
      />
   </cms:if>

   <cms:input type="checkbox" name="schwerpunkt" opt_values="" id="schwerpunkt" class="ignore" />
   <div class="row">
      <div class="col-xs-3">
         <input id="schwerpunkt0" type="checkbox" name="schwerpunkt[]" value="Energieeffizienz" />
         <label for="schwerpunkt0"><img src="angebotsschwerpunkt_1.jpg"><h4>Energieeffizienz</h4></label>
      </div>
      <div class="col-xs-3">
         <input id="schwerpunkt1" type="checkbox" name="schwerpunkt[]" value="Einbruchsicherheit" />
         <label for="schwerpunkt1"><img src="angebotsschwerpunkt_2.jpg"><h4>Einbruchschutz</h4></label>
      </div>
      <div class="col-xs-3">
         <input id="schwerpunkt2" type="checkbox" name="schwerpunkt[]" value="Schallschutz" />
         <label for="schwerpunkt2"><img src="angebotsschwerpunkt_3.jpg"><h4>Schallschutz</h4></label>
      </div>
      <div class="col-xs-3">
         <input id="schwerpunkt3" type="checkbox" name="schwerpunkt[]" value="Weiss nicht" />
         <label for="schwerpunkt3"><img src="weiss_nicht.jpg"><h4>Weiss nicht</h4></label>
      </div>
   </div>

   <input type="submit" id="submit-button">

</cms:form>


The essential part ist the assignment of the form variable frm_schwerpunkt to the variable schwerpunkt in the template:

Code: Select all
<cms:db_persist_form 
   ...
   schwerpunkt=frm_schwerpunkt
   ...
/>
3 posts Page 1 of 1