CMS 2.0+ Search Form Template [solved]

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

CMS 2.0+ Search Form Template [solved]

Post by howey »

Hi, at the risk of being shot down for using Bootstrap, I would like to be able to change the css class that is used on the Search submit form. I can't find anywhere to change this I looked at the template but all the form class detail seems to be generated with the $startform tag.

Code: Select all

{$startform}
<label for="{$search_actionid}searchinput">{$searchprompt}:&nbsp;</label><input type="text" class="search-input" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" size="20" maxlength="50" placeholder="{$searchtext}"/>
{*
<br/>
<input type="checkbox" name="{$search_actionid}use_or" value="1"/>
*}
<input class="search-button" name="submit" value="{$submittext}" type="submit" />
{if isset($hidden)}{$hidden}{/if}
{$endform}
I have used this template

Code: Select all

{$startform}
<div class="form-group headSearch">
<input type="text" class="search-input" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" size="20" maxlength="50" placeholder="{$searchtext}"/>
</div>
<button name="submit" value="{$submittext}" type="submit" class="btn btn-default headSearch">Submit</button>
{if isset($hidden)}{$hidden}{/if}
{$endform}
with this tag

Code: Select all

{search inline="false" resultpage="search" submit="Search" formtemplate="search_top"}
Which outputs

Code: Select all

<form id="cntnt01moduleform_1" method="get" action="http://localhost:8888/foundation/" class="cms_form">
<div class="hidden">
<input type="hidden" name="mact" value="Search,cntnt01,dosearch,0" />
<input type="hidden" name="cntnt01returnid" value="34" />
</div>

<div class="form-group headSearch">
<input type="text" class="search-input" id="cntnt01searchinput" name="cntnt01searchinput" size="20" maxlength="50" placeholder="Enter Search..."/>
</div>
<button name="submit" value="Search" type="submit" class="btn btn-default headSearch">Submit</button>
</form>
Therefore I don't get the css class on the form.

Any help pointers would be much appreciated. I can hack my way around this, but I would prefer to be able to tackle it at the root code generation.

Thanks
Last edited by howey on Thu Oct 29, 2015 5:34 pm, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: CMS 2.0+ Search Form Template

Post by calguy1000 »

Okay... as an oversight, we forgot to modify the default search form in 2.0.
But... this should still be possible.

Instead of using {$startform} and {$endform}
try using {form_start action=dosearch class="foo"} and {form_end} respectively.

and check out the help for the {form_start} plugin.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
howey
Forum Members
Forum Members
Posts: 158
Joined: Fri Sep 14, 2007 1:05 pm

Re: CMS 2.0+ Search Form Template

Post by howey »

Hi, thanks for such a quick reply.

I added the tag as suggested and then fiddled with the parameters/tag. Just had to figure out that I had to add the returnid parameter, to make sure the results appeared on the search results page, rather than replacing the content tag on the originating page.

Code: Select all

{form_start action=dosearch class="navbar-form navbar-left" method=get returnid="51"}
<div class="form-group headSearch">
<input type="text" class="search-input" id="{$search_actionid}searchinput" name="{$search_actionid}searchinput" size="20" maxlength="50" placeholder="{$searchtext}"/>
</div>
<button name="submit" value="{$submittext}" type="submit" class="btn btn-default headSearch">Submit</button>
{if isset($hidden)}{$hidden}{/if}
{form_end}
SUCCESS, it seems to work fine. Many thanks, I would never have got there without your help.

NB: I am working in a development environment using MAMP, so I haven't got pretty urls at the moment. Although I wouldn't have thought that would make to much of a difference.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: CMS 2.0+ Search Form Template [solved]

Post by calguy1000 »

I don't think you technically need to specify the returnid, it should be automatic.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Post Reply

Return to “CMSMS Core”