Thread tagged as: Forms

Select option values

Hey guys

I'm find a problem with this:

<perch:input type="select" id="service_due" options="Select|,January,February,March,April,May,June,July,August,September,October,November,December" class="required" />

I'm looking to have the first option with an empty value attribute on the first option. Perch doesn't output the value attribute at all, so 'required' validation fails with Adding in value="" solves that issue.

How can we do that?


Russell Back

Russell Back 2 points

  • 7 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

No value attribute and value="" are semantically equivalent. When you say that required validation fails, do you mean it passes it as having a value when no value is set?

Hi, Drew.

Yep I get that, but unfortunately the script plugin we use doesn't evaluate correctly. Is there a way to force the output of that empty attribute value?

Drew McLellan

Drew McLellan 2638 points
Perch Support

I don't think so currently.

Can we hardcode the select menu and still have it picked up by the Forms add-on on submission?

Hmmm... I've tried and it appears not.

In the end I just extended the validation script so all sorted.