Forum

Thread tagged as: Problem, Forms

Contact form - error messages not appearing

Hello,

First time working with Perch .. really great cms by the way! Keep up the good work!

I created a contact form but I'm having problems with the error messages .. I can't get them to appear on my page. Any idea why?

I watched this video https://docs.grabaperch.com/video/v/form-error-messages/ which is great but what's in the contact-error.html exactly? How's the CSS? It would be useful to have access to these files if possible ..

Also, I can't seem to have an empty first item in my select type .. although I use allowempty -> true or false doesn't matter .. it doesn't work ..

Thanks a lot for your help!

        <perch:form id="form-contact" method="post" app="perch_forms" role="form" class="bootstrap-frm">

            <div class="hidden_honeypot">
                <perch:input type="text" id="spamkiller" antispam="honeypot" />
            </div>

            <perch:error for="all" type="general">
                <div class="alert error">
                    <perch:content id="error" type="textarea" label="General error message" editor="ckeditor" html="true" />
                </div>
            </perch:error>

            <div> 
                <perch:label for="name"><span class="blue_text" title="verplichte veld">Naam en voornaam</span></perch:label><br />            
                <perch:input type="text" id="name" required="true" label="Naam en voornaam" size="100" maxlength="100" />
                <perch:error for="name" type="required"><p class="about-error">Vul hier uw naam en voornaam in alstublieft</p></perch:error>
            </div>

            <div> 
                <perch:label for="email"><span class="blue_text" title="verplichte veld">E-mail adres</span></perch:label><br />
                <perch:input type="email" id="email" required="true" label="E-mail" placeholder="you@company.com" size="100" maxlength="100" />
                <perch:error for="email" type="required"><p class="about-error">Vul hier uw e-mail adres in alstublieft</p></perch:error>
                <perch:error for="email" type="format"><p class="about-error">U hebt een onjuiste e-mail adres ingevoerd</p></perch:error>
            </div>

            <div>              
                <perch:label for="select"><span class="blue_text">Onderwerp</span></perch:label><br />
                <perch:input type="select" id="select" label="Onderwerp" options="Afspraak,Sollicitatie,Gastlezing,Andere" allowempty="false" required="true" />
                <perch:error for="select" type="required"><p class="about-error">Maak hier een keuze alstublieft</p></perch:error>
            </div>

            <div>
                <perch:label for="message"><span class="blue_text" title="verplichte veld">Bericht</span></perch:label><br />
                <perch:input type="textarea" id="message" required="true" label="Bericht" cols="100" size="100" rows="8"/>
                <perch:error for="message" type="required"><p class="about-error">Vul hier uw bericht in alstublieft</p></perch:error>
            </div>

            <div>
                <perch:label for="cv"><span class="blue_text">Bijlage opsturen ENKEL in pdf formaat (maximum grootte 5Mb)</span></perch:label><br />
                <perch:input type="file" id="cv" accept="pdf" />
                <perch:error for="cv" type="format"><p class="about-error">Enkel pdf formaat wordt toegestaan met een maximum grootte van 5Mb</p></perch:error>
            </div>

            <div>
                <perch:input type="submit" id="submit" value="Verzenden" class="button" />
            </div>

                <perch:success>
                    <perch:content id="success" type="textarea" label="Bedankingsbericht" editor="ckeditor" html="true" />
                </perch:success>

    </perch:form>
Geoffrey Cardoen

Geoffrey Cardoen 0 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What happens when you submit the empty form?

I get an error message .. but the classic one .. like on the demo version of Swift .. just a pop-up ..

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do you mean the HTML5 browser validation error before the form submits?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's to be expected - if your browser validates the form it will be correct by the time Perch gets to see it.

right :D how silly .. so I guess I just have to add this attribute to stop my browser from validating the form?

novalidate="novalidate"

How about the empty first item in my select type .. allowempty (true or false) doesn't seem to work ..

thanks for your help!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Use:

options="Please choose|,A,B,C"

Good idea. Thanks!

Hello again,

another problem on this form .. I can't seem to get the error message to appear when sending the wrong file format as an attachment:

<div>
      <perch:label for="cv"><span class="blue_text">Send attachment in pdf format (maximum size 5Mb)</span></perch:label><br />
      <perch:error for="cv" type="format"><p class="about-error">Please make sure your attachment is in pdf format (maximum size 5Mb)</p></perch:error>
      <perch:input type="file" id="cv" accept="pdf" />
</div>

do you see anything wrong? Thanks for your help!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Is pdf defined as a group in your filetypes.ini file? It's not by default.

Apparently it is .. here is the content of my filetypes.ini

[image]
image/*

[pdf] 
application/pdf

[text]
application/plain
text/plain

[richtext]
application/rtf
application/x-rtf
text/richtext
text/rtf

[xml]
application/x-latex
application/xml
text/xml

[zip]
application/rar
application/x-bzip
application/x-bzip2
application/x-compressed
application/x-gzip
application/x-rar
application/x-rar-compressed
application/x-sit
application/x-stuffit
application/x-zip
application/x-zip-compressed
application/zip
multipart/x-gzip
multipart/x-zip
application/gnutar

[audio]
application/x-midi
audio/*

[video]
application/x-troff-msvideo
video/*

[flash]
application/x-shockwave-flash

[office] 
application/arj
application/excel
application/mspowerpoint
application/msword
application/octet-stream
application/onenote
application/powerpoint
application/vnd.ms-excel
application/vnd.ms-excel.addin.macroEnabled.12
application/vnd.ms-excel.sheet.binary.macroEnabled.12
application/vnd.ms-excel.sheet.macroEnabled.12
application/vnd.ms-excel.template.macroEnabled.12
application/vnd.ms-office
application/vnd.ms-officetheme
application/vnd.ms-powerpoint
application/vnd.ms-powerpoint.addin.macroEnabled.12
application/vnd.ms-powerpoint.presentation.macroEnabled.12
application/vnd.ms-powerpoint.slide.macroEnabled.12
application/vnd.ms-powerpoint.slideshow.macroEnabled.12
application/vnd.ms-powerpoint.template.macroEnabled.12
application/vnd.ms-word
application/vnd.ms-word.document.macroEnabled.12
application/vnd.ms-word.template.macroEnabled.12
application/vnd.oasis.opendocument.chart
application/vnd.oasis.opendocument.database
application/vnd.oasis.opendocument.formula
application/vnd.oasis.opendocument.graphics
application/vnd.oasis.opendocument.graphics-template
application/vnd.oasis.opendocument.image
application/vnd.oasis.opendocument.presentation
application/vnd.oasis.opendocument.presentation-template
application/vnd.oasis.opendocument.spreadsheet
application/vnd.oasis.opendocument.spreadsheet-template
application/vnd.oasis.opendocument.text
application/vnd.oasis.opendocument.text-master
application/vnd.oasis.opendocument.text-template
application/vnd.oasis.opendocument.text-web
application/vnd.openofficeorg.extension
application/vnd.openxmlformats-officedocument.presentationml.presentation
application/vnd.openxmlformats-officedocument.presentationml.slide
application/vnd.openxmlformats-officedocument.presentationml.slideshow
application/vnd.openxmlformats-officedocument.presentationml.template
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
application/vnd.openxmlformats-officedocument.spreadsheetml.template
application/vnd.openxmlformats-officedocument.wordprocessingml.document
application/vnd.openxmlformats-officedocument.wordprocessingml.template
application/wordperfect
application/x-excel
application/x-msexcel
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok, great. If it's not being detected it may be that your server doesn't have the necessary support for it.

Right, thanks! I tested this on my synology nas server .. it's probably gonna work once published.

Thanks for your help!