Forum

Thread tagged as: Question

Perch Forms not validating

I am having problems with Perch forms, in creating a select element.

For a start, there seems to be no way to create an <optgroup></optgroup> element.

Also, any suggestions so far about placeholders apply them to the select element, which is invalid HTML5.

Perch forms claim to use all the elements of HTML5 but I do not see this.

Using blank or empty option elements is also not allowed so is there a remedy for this because what is the point of having a form where the default option is already selected.

Apologies for multiple posts on this.

Do I need to do this via the DOM instead?

Garth Holmes

Garth Holmes 1 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You need to show me what you're doing, what output you're getting, and what output you expected.

The part of the form in question is:

<perch:label for="enquiry">Enquiry</perch:label>
<perch:input id="enquiry" type="select" label="Enquiries" options="General Enquiry, Request Information, Other" />
<perch:error for="enquiry" type="required">Specify enquiry type</perch:error>

It seems that using required="true on the perch:input element does not validate with w3c.

Also, if I use `options=", General Enquiry, Request Information, Other"' this produces an element with no text between opening and closing tags.

I hope I have provided enough information

Drew McLellan

Drew McLellan 2638 points
Perch Support

The W3C validator will never see the perch:input tag. Are you validating your template, or the resulting HTML?

Drew McLellan said:

The W3C validator will never see the perch:input tag. Are you validating your template, or the resulting HTML?

The resulting HTML of course, but I've changed the perch template to bare bones and it validates from what it was in previous posts that I've made.

There are other posts in this forum with questions along similar lines and I am starting to doubt that Perch is able to do what I'm asking and that it is by design.

Drew McLellan

Drew McLellan 2638 points
Perch Support

To be honest I'm completely unclear as to what you're asking. You've posted multiple statements without detail and keep reposting and changing the issue. I'm really struggling to be able to effectively help you.

I'll do my best with a direct question (without starting another thread) ...

Is there any way to add an <optgroup> element to group options together in a Perch form?

Thanks

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, we don't have support for optgroups currently.

Ok, thanks for letting me know.

So were I to use standard HTML in a Perch form template, this would not be able to displayed in Perch as a submitted form?

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's correct.