i have created a controller with action subscribers
like this
class LeadsController extends SugarController
{
public function action_subscriber()
{
$this->view = 'sub';
}
}
and i have added a button callled as subscribers in my search form
now on click on that button if i want to make search happen so i am calling SUGAR.savedViews.setChooser(); SUGAR.ajaxUI.submitForm(this.form); this two function in SearchFormGeneric.tpl
<input tabindex='2' title='go_select' id='go_select_b' ondblclick="SUGAR.savedViews.setChooser(); SUGAR.ajaxUI.submitForm(this.form);" class='button' type='button' name='subscriber' value='Subscriber'/>
but when i click on the button its going to
module=Leads&action=index
i have my logic written in action called subscriber , so when i click on my custom button it should search with .
module=Leads&action=subscriber
so how can i change the action on click of "SUGAR.savedViews.setChooser(); SUGAR.ajaxUI.submitForm(this.form); this function
Search with this SUGAR.ajaxUI.submitForm(document.forms[‘DetailView’]); on post
i found one post related to this and i tried some thing like this SUGAR.ajaxUI.submitForm(document.forms[‘SubView’]);, but it did not work.
please can any one guide me on this ????
finally got the solution , so what we where trying was based on custom button on search view we were trying to modify the search .
so , go to search view under : suitecrm/custom/include/SearchForm/tpls/SearchFormGeneric.tpl
and add the button
{if $module eq 'o_order'}
<input tabindex='2' title='Subscribers' id='get_report' onclick ="SUGAR.ajaxUI.submitForm(this.form);" class='button' type='submit' name='button' value='Subscribers'/>
{/if}
and put the condition under the method where we are generating the list based in search condition
go to : suitecrm/custom/modules/o_order/views/view.list.php
the function which is generating the list data based on query is listViewProcess()
public function listViewProcess() // genrating listview
{
$this->processSearchForm();
$this->lv->searchColumns = $this->searchForm->searchColumns;
if(!$this->headers)
return;
if(empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false){
$this->lv->ss->assign("SEARCH",true);
$this->lv->setup($this->seed, 'include/ListView/ListViewGeneric.tpl', $this->where, $this->params);
$savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : (' - ' . $_REQUEST['saved_search_select_name']);
$configObject = new Configurator();
$configObject->loadConfig();
$configObject->config['save_query'] = 'no';
$configObject->saveConfig();
echo $this->lv->display();
if($_REQUEST['button']=='Subscriber'){
$this->getpdf($this->where);
}
}
}
so we are passing the search condition to getpdf() function as parameter
that's it do repair and rebuild from the admin log in and you can see the changes .
hope this helps some one !