Problems, need help? Have a tip or advice? Post it here.
4 posts Page 1 of 1
I am having a little trouble implementing a databound form. I am getting this error:
Email: Required field cannot be left empty
Phone: Required field cannot be left empty
URL: Required field cannot be left empty
Even though I am filling those fields out
But I am entering info in those fields.
Can you help me?

here is the form code:
<cms:form masterpage='distributorsform.php' mode='create' enctype='multipart/form-data' method='post' anchor='0' class="contact-form" id="contact-form">
<cms:if submit_success >
<h4>Success: Your application has been submitted.</h4>
</cms:if>
<cms:if k_success >
<cms:check_spam email=frm_email />
<cms:db_persist_form
_invalidate_cache='0'
_auto_title='1'
/>
<cms:set_flash name='submit_success' value='1' />

</cms:if>
<cms:if k_error >
<div class="error">
<cms:each k_error >
<br><cms:show item />
</cms:each>
</div>
</cms:if>
<div class="controls controls-row">
<div class="control-group span6">
<cms:input type="bound" name="distributor_form_fname" id="first_name" value="" class="span12" placeholder="First Name"/>
</div>
<div class="control-group span6">
<cms:input type="bound" name="distributor_form_lname" id="last_name" value="" class="span12" placeholder="Last Name"/>
</div>
</div>
<div class="controls controls-row">
<div class="control-group span6">
<input type="bound" name="distributor_form_email" id="email" value="" class="span12" placeholder="Email"/>
</div>
<div class="control-group span6">
<input type="bound" name="distributor_form_phone" id="phone" value="" class="span12" placeholder="Phone"/>
</div>
</div>
<div class="controls controls-row">
<div class="control-group span6">
<input type="bound" name="distributor_form_url" id="website" value="" class="span12" placeholder="Company Website"/>
</div>
<div class="control-group span6">
<cms:input type="bound" name="distributor_form_bustype" opt_values="Which Best Describes You? | Physicians & Clinics | Rehabilitation & PT | Chiropractic Physicians | Plastic Surgeons | Sleep Clinics | Athletic facilities & Clubs | Spas & Wellness | Resorts & Hotels"/>
</div>
</div>
<div class="controls controls-row">
<div class="control-group span12">
<input type="bound" name="distributor_form_subject" id="subject" value="Intrested in Selling PILLO1 at Spa's" class="span12" placeholder="Subject"/>
</div>
</div>
<div class="controls controls-row">
<div class="control-group span12">
<cms:input type="bound" name="distributor_form_message" id="message" class="span12" placeholder="Message" rows="5"/>
</div>
</div>
<div class="controls controls-row">
<div class="control-group span12">
<cms:input type="submit" name='submit' class="btn btn-large btn-primary btn-block" id="submitButton" value="<cms:show distributor_form_button/>"/>
</div>
</div>
<input type="hidden" name="k_hid_contact-form" id="k_hid_contact-form" value="contact-form" />
</cms:form>

And here is the data code from a different template:
<?php require_once( 'cms/cms.php' ); ?>
<cms:template title='Distributors Form' clonable='1' order='12'>
<cms:editable name='distributor_form_fname' label='First Name' required='1' type='text' order='3'/>
<cms:editable name='distributor_form_lname' label='Last Name' required='1' type='text' order='4'/>
<cms:editable name='distributor_form_email' label='Email' required='1' type='text' validator='email' order='5'/>
<cms:editable name='distributor_form_phone' label='Phone' required='1' type='text' order='6'/>
<cms:editable name='distributor_form_url' label='URL' required='1' type='text' validator='url' order='7'/>
<cms:editable name="distributor_form_bustype" label='Business Type' type="dropdown" opt_values="Which Best Describes You? | Physicians & Clinics | Rehabilitation & PT | Chiropractic Physicians | Plastic Surgeons | Sleep Clinics | Athletic facilities & Clubs | Spas & Wellness | Resorts & Hotels" order='8'/>
<cms:editable name='distributor_form_subject' label='Email Subject' type='text' order='9'/>
<cms:editable name="distributor_form_message" label='Email Message' type='textarea' rows='5' wrap='physical' order='10'/>
</cms:template>
<?php COUCH::invoke(); ?>
You stopped using <cms:input tags after the first two, all of the inputs in the form need to be <cms:input tags instead of <input to work as a databound form, as it is on submit there are 0 inputs for those fields that are required so it throws the 'cannot be empty' error. Else it would successfully input the first two fields into the relevant editable's but not the rest of the form.
Image
Dang, I knew it was going to be something stupid. Thanks for taking the time Bartonsweb.
No problem, I've made similar mistakes myself, sometimes it takes another set of eyes to spot little things :)
Image
4 posts Page 1 of 1
cron