Forum

Thread tagged as: Question, Problem, Forms

Access Perch Form ID's?

I am using Zurb Foundation's Range Finder within a Perch Form

Is there a way to access the 'form1_" perch prepends to the input ID's?

I have tried

<perch:content id="perch_item_index" type="hidden" />

but that is obviously incorrect.

My template Markup looks like this:

 <perch:form id="contact" method="post" app="perch_forms">
  <div class="row">
    <div class="small-3 columns">
       <label id="sliderLabel">Daily Rate</label>
     </div>
    <div class="small-6 columns">
<!-- Need to feed in the perch form ID below -->
      <div class="range-slider round" data-slider data-options="display_selector: #<perch:content id="perch_form_index" type="hidden" />_day-rate; step: 50; initial:100; start: 100; end: 2000">
       <span class="range-slider-handle" role="slider" tabindex="0" aria-labelledby="sliderLabel"></span>
       <span class="range-slider-active-segment"></span>
     </div>
    </div>
    <div class="small-3 columns">
       <perch:input type="number" id="day-rate" value="100"  />
       <perch:error for="day-rate" type="required">Please select an amount</perch:error>
    </div>
<...>
 </perch:form>

I need to do this as I am using the template twice on the same page.

Thanks!

Jon Douglas-Beveridge

Jon Douglas-Beveridge 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You can use the prefix attribute on the perch:form tag to set the form1_ to something predictable.

https://docs.grabaperch.com/docs/form/template-tags/form/

Keep in mind that if you do that, you'll need to make sure that you don't have multiple forms with the same prefix on each page, as Perch can no longer manage that for you.

Good Stuff. Thanks Drew.