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

I've read many topics about this but haven't found the answer to this specific question. I hope this is no duplicate.

For a vacancy website I have created a databound form for applicants to repsond to a vacancy (much like the form in this example:http://docs.couchcms.com/concepts/databound-forms.html). Now I would like to make some fields "required" I know that I should use the input type instead of the bound type and bind the two together in the <cms:db_persist_form/> tag.

However, I also have one field of the securefile type. This is not an input type. So I cannot use this method for making this field required.

How can I still require applicants to submit the securefile.?

Code: Select all
<cms:form
   masterpage="ats/sollicitaties.php"
   mode='create'
   enctype='multipart/form-data'
   method='post'
   anchor='1'
   class="bureau_form"
>

   <cms:if k_error >
      <div class="error">
         <cms:each k_error >
            <br><cms:show item />
         </cms:each>
      </div>
   </cms:if>
   <cms:if k_success >
      <cms:db_persist_form
         _invalidate_cache='0'
         _auto_title='1'
         status="onbeantwoord"
         route="Bureau"
         telefoon=frm_telefoon
         email=frm_email
      />
      <cms:set_flash name='submit_success_bureau' value='1' />
      <cms:redirect link />
   <cms:else/>
      <div class="row">
         <div class="col-md-12 col-lg-6">
            <cms:input name="naam" placeholder="Naam" type="bound" />
            <label>CV
               <cms:input name="cv_bestand" type="bound"/>
            </label>
         </div>
         <div class="col-md-12 col-lg-6">
            <cms:input type="text" name="id_code" placeholder="Uw ID code" required="1" />
            <cms:input name="email" placeholder="E-mail contactpersoon" type="text" validator='email' required="1"/>
            <cms:input name="telefoon" placeholder="Telefoonnummer contactpersoon" type="text" validator="non_negative_integer| min_len=10 | max_len=10" validator_msg="Het opgegeven telefoonnummer lijkt niet correct, gebruik enkel cijfers"/>
         </div>
      </div>
           <button type="submit" class="white">Insturen</button>
               </cms:if>
</cms:form>
No one?
Hi Saskia,

In DataBound forms, all bound <cms:input>s automatically inherit all parameters of their corresponding <cms:editable>s.
So, in your case, if you set required='1' for the type 'securefile' editable region, the databound input should automatically enforce the required constraint. Nothing more needs to be done on the frontend.

Are you running into any problem with this?
3 posts Page 1 of 1