public function buildQuickForm() {
parent::buildQuickForm();
+ $this->addButtons(array(
+ array(
+ 'type' => 'next',
+ 'name' => $this->_action & CRM_Core_Action::DELETE ? ts('Delete') : ts('Save'),
+ 'isDefault' => TRUE,
+ ),
+ array(
+ 'type' => 'cancel',
+ 'name' => ts('Cancel'),
+ ),
+ )
+ );
+
if ($this->_action & CRM_Core_Action::DELETE) {
- $this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Delete'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
- );
return;
}
- else {
- $this->addButtons(array(
- array(
- 'type' => 'next',
- 'name' => ts('Save'),
- 'isDefault' => TRUE,
- ),
- array(
- 'type' => 'cancel',
- 'name' => ts('Cancel'),
- ),
- )
- );
- }
$attributes = CRM_Core_DAO::getAttribute('CRM_SMS_DAO_Provider');
$providerNames = CRM_Core_OptionGroup::values('sms_provider_name', FALSE, FALSE, FALSE, NULL, 'label');
$apiTypes = CRM_Core_OptionGroup::values('sms_api_type', FALSE, FALSE, FALSE, NULL, 'label');
- $this->add('select', 'name', ts('Name'), array('' => '- select -') + $providerNames, TRUE, array('onchange' => "reload(true)"));
+ $this->add('select', 'name', ts('Name'), array('' => '- select -') + $providerNames, TRUE);
$this->add('text', 'title', ts('Title'),
$attributes['title'], TRUE
{if $action eq 1 or $action eq 2}
<script type="text/javascript" >
{literal}
- function reload(refresh) {
- var provider = document.getElementById("name");
- var url = {/literal}"{$refreshURL}"{literal}
- var post = url + "&key=" + provider.value;
- if( refresh ) {
- window.location.href = post;
- }
- }
+ CRM.$(function($) {
+ var $form = $("#{/literal}{$form.formName}{literal}");
+ $('select[name=name]', $form).change(function() {
+ var url = {/literal}"{$refreshURL}"{literal} + "&key=" + this.value;
+ $(this).closest('.crm-ajax-container, #crm-main-content-wrapper').crmSnippet({url: url}).crmSnippet('refresh');
+ });
+ });
{/literal}
</script>
{/if}