<![CDATA[ Dynamic selection of "parents" - My Forums]]> https://forums.modx.com/thread/?thread=75276 <![CDATA[Re: Dynamic selection of]]> https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417487
<select id="asParents" name="parents">
        <option value="0" [+as.selected:is=`0`:or:is=``:then=`selected="selected"`+]>All</option>
        <option value="1" [+as.selected:is=`1`:then=`selected="selected"`+]>One</option>
        <option value="2" [+as.selected:is=`2`:then=`selected="selected"`+]>Two</option>
        <option value="3" [+as.selected:is=`3`:then=`selected="selected"+]>Three</option>
</select>


And in the config file:
$dcfg['parents'] = $_POST['parents'];
$modx->setPlaceholder("as.selected", $_POST['parents']);


]]>
sottwell Mar 26, 2012, 05:53 AM https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417487
<![CDATA[Re: Dynamic selection of]]> https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417239
Create a form with the addition of a select drop-down whose values are the IDs of the parent resources:
<form id="[+as.formId+]" action="[+as.formAction+]" method="post">
    <fieldset>
    <label>
          <input id="[+as.inputId+]" type="text" name="search" value="[+as.inputValue+]">
    </label>
   <label>
        <select name="parents" id="selectParents" size="1">
          <option value="1">One</option>
          <option value="2">Two</option>
          <option value="3">Three</option>
        </select>
  </label>
    [+as.liveSearch:is=`0`:then=`
        <label>
            <input id="[+as.submitId+]" type="submit" name="sub" value="[+as.submitText+]" />
        </label>
    `+]
    </fieldset>
</form>


Create a custom config file and put it in the ajaxSearch/configs folder:
$dcfg['parents'] = $_POST['parents'];


And call AjaxSearch:
[!AjaxSearch? &config=`one` &ajaxSearch=`0` &advSearch=`exactphrase` &showInputForm=`1` &tplInput=`asAdvSearchInput`!]
]]>
sottwell Mar 23, 2012, 07:20 AM https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417239
<![CDATA[Re: Dynamic selection of]]> https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417190 sottwell Mar 22, 2012, 05:44 PM https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417190 <![CDATA[Re: Dynamic selection of]]> https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417183 But there's no source for the config files used, just the snippet call and the chunk tpls. This is right. The main reason is that each solution depends of the search form elements and require to be adapted to each specific needs.
So I never explained how the config could be used and I provided these kind of developments, only, as a development services.]]>
coroico Mar 22, 2012, 04:49 PM https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417183
<![CDATA[Re: Dynamic selection of]]> https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417176 sottwell Mar 22, 2012, 03:39 PM https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417176 <![CDATA[Re: Dynamic selection of]]> https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417142 http://www.evo.wangba.fr/index.php?id=255

or like this : http://www.evo.wangba.fr/index.php?id=256


This two demos have been done by customizing ajaxSearch through the config file.]]>
coroico Mar 22, 2012, 11:26 AM https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417142
<![CDATA[Dynamic selection of "parents"]]> https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417109 sottwell Mar 22, 2012, 09:44 AM https://forums.modx.com/thread/75276/dynamic-selection-of-parents#dis-post-417109