Problems, need help? Have a tip or advice? Post it here.
7 posts Page 1 of 1
i have a custom field called year in a repeatable region that I want to be able to search. I have a form that has "from year" and "to year" and would like to return all records that fall in the range of said years.

I have this so far:

<cms:pages masterpage='investigator/article-database/article-list.php'
custom_field="article_date=<cms:gpc 'fromyear' />" folder="<cms:gpc 'cat' />"
show_future_entries = '1'>

I just need to know how to include the range search within the article_date custom field. This works fine when only the start year is filled out.

thanks
Not sure I understood the question completely -
if the field is indeed within a repeatable-region, I am afraid, it won't be searchable.

The code that you posted, however, seems to be searching within a normal editable region (article_date). To set a range for such fields, you can use
Code: Select all
custom_field="article_date >= <cms:gpc 'fromyear' /> | article_date < <cms:gpc 'toyear' />" 
Hi KK SIR,

I like to search by date range using filter search input field , without any custom_field (Editable Regions),
using start_on='date ' stop_before='date'

is it possible?

I tried something like this
Code: Select all
<cms:form name="quicksearch" id="quicksearch" anchor='0'>
<cms:set my_search_str="<cms:concat my_search_str ' | start_on==' ??/>"  scope='global'/>
<cms:set my_search_str="<cms:concat my_search_str ' | stop_before==' ??/>"  scope='global'/>

<div>
         <label>Start Date</label>
         <cms:input type="text"             
               name="start_on" id="start_on" />
      </div>
      <div>
         <label>Before Date</label>
         <cms:input type="text"             
               name="stop_before" id="stop_before" />
      </div>
   

      <div class="buttonset">
         <cms:input type="submit" class="fbsubmitbtn" value="Start Searching!" name="submit"/>
      </div>

   </cms:form>


kindly guide me.

Thanks
Hi,

The start_on and stop_before parameters of <cms:pages> tag always refer to the publish_date of the pages.
If you set them using the form, it will work but will fetch pages filtered by their dates of publication - not by the editable region you mentioned in your original post.

Are you sure that is what you want?
Hi, KK Sir,

At this moment I like to fetch pages filtered by their dates of publication - not by the editable region.

Thanks
That should be straightforward enough.

As you know, values of form inputs are made available by prepending their names with 'frm_'.
So the values of the two inputs would be 'frm_start_on' and 'frm_stop_before'.
Upon successful form submission, save both as global variables as shown below and then use them in <cms:pages> tag -
Code: Select all
<cms:form name="quicksearch" id="quicksearch" anchor='0'>
    <cms:if k_success>
        <cms:set my_start_on=frm_start_on  scope='global'/>
        <cms:set my_stop_before=frm_stop_before  scope='global'/>
    </cms:if>

    <div>
        <label>Start Date</label>
        <cms:input type="text" name="start_on" id="start_on" />
    </div>
    <div>
        <label>Before Date</label>
        <cms:input type="text" name="stop_before" id="stop_before" />
    </div>

    <div class="buttonset">
        <cms:input type="submit" class="fbsubmitbtn" value="Start Searching!" name="submit"/>
    </div>
</cms:form>

<cms:pages start_on=my_start_on stop_before=my_stop_before >
    ..
</cms:pages>

Hope it helps.
Helped a lot!

Thanks a million.
7 posts Page 1 of 1