4

You can use the word replacements feature, if you want to replace the word everywhere. Or if you're just using that field for a different purpose, create a new custom field instead.


3

@ichi that rule shouldn't be existing anymore because it was removed in 5.33 https://github.com/civicrm/civicrm-packages/commit/148eb5483caa1059d031f11aaf32b391bead1c66 I would suggest applying that patch onto your system and that should fix the problem


3

on_change is executed when setting value is changed. You can either set it 'on_change' => [ ['CLASS_NAME', 'functionName'], ], Else 'on_change' => [ 'CLASS_NAME::functionName', ], A good example would be https://github.com/civicrm/civicrm-core/blob/master/settings/Localization.setting.php#L145 HTH Pradeep


3

I usually find more detailed examples by looking in the CiviCRM code, which is exactly where I found the answer to the " i do not want time" question a while ago :-) As I found it I can share it with you: $this->add('datepicker', 'activity_compare_date', ts('Comparison Date'), array('placeholder' => ts('Compare with')),FALSE, array('time' => FALSE)...


3

Paul B, Its not necessary to have 2 separate tpl for View and edit, the logic can be added in one tpl or php file. But for convenience Civi tries to keep it separate. A good example for view and add form will be New/Update/ View Membership forms. The action for CRUD is registered here https://github.com/civicrm/civicrm-core/blob/master/CRM/Member/xml/Menu/...


3

You will need to over-ride the button to include existing + new button through buildform. The other option is to add button using smarty in tpl file using below snippet {crmButton p='civicrm/request' q="action=browse&reset=1&gid=$gid" icon="th-list"}{ts}Request for Approval{/ts}{/crmButton} HTH Pradeep


3

I was able to disable double submission of the form by adding the following to the bottom of the form's TPL file: {literal} <script type="text/javascript"> // PREVENT DOUBLE SUBMISSION OF FORM CRM.$(function ($) { $(document).ready(function () { $('form').preventDoubleSubmission(); //block double submission of form }); ...


3

I just created a custom extension that uploads a CSV file and reads it into a table. I added the file element in buildQuickForm as follows $this->add('File', 'uploadFile', ts('Import Data File'), 'size=30 maxlength=255', TRUE); And the processing of the file was is done with public function preProcess() { if (isset($this->_submitFiles['...


3

Try some CSS: label[for=contact_source] { /* ...definitions here... */ } You can use the ::after to add arbitrary text, as per, e.g. https://css-tricks.com/almanac/selectors/a/after-and-before/


2

This can be done by adding javascript directly to the TPL file associated with the QuickForm. In the FORM php file The following are the elements that I add for selecting: $this->addEntityRef('field_dc_group', ts('Select DC for the Leader'), array( 'entity' => 'group', 'api' => array( 'params' => array( ...


2

This is how you do it: CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, 3); $this->add('select', 'financial_type', ts('Financial Type'), $financialTypes, 'TRUE' ); $this->_elements[4]->setSelected(9); You need to inspect $this and determine which of the elements is the ...


2

Please have a look at the code here and see if it can help with what you need.


2

If you take a look at the formRule() method, you will notice that it is static: public static function formRule($params) { ... When methods are invoked statically, you don't have access to $this. There is a similar construct to $this->, which is self:: (see http://php.net/manual/en/language.oop5.static.php) for more info, but I don't think it will help ...


2

You already had many answers how to. I will make a recommendation: create a custom field rather than manipulate a core CiviCRM field? It will be easier to maintain if fields change in updates of CiviCRM.


2

You missed a param to that function. The 4th param is attributes, which you can pass as an empty array, and the 5th param is required, which you can pass TRUE.


2

buildForm hook is used to add the elements on the form. To store the values of your select element, you need to look at postProcess hook which is called after the form is submitted. You'll get the submitted select value in $form parameter. Use this and store the value in your expected table.


1

Resolved this issue by using: <td><a href="{crmURL p='civicrm/EditComponent' q='reset=1&action=update&id=2'}" class="crm-popup"> Edit </a><a href="javascript:deleteComponent({$component.id})"> Delete </a></td></tr>


1

The way I've done this is: in preProcess, if (!empty($_GET['reset'])) { then inspect GET for the initialisation data, and if it's valid, store it using $this->set('key', $validData). I've also set some object properties in this stage, but these will only be around for one request, including a showForm one. I have called setMessage() with any initiation ...


1

That backtrace is very helpful. The issue has something to do with your custom field with an ID of 1. I've seen this when, for instance, the "Search by Range" option was set on a field that displays as an option value. Somewhere in the field's definition are conflicting settings. If this isn't enough to track down the issue, please run this SQL ...


1

For most uses of CRM_Core_Form->add(), all the arguments you need are in the docblock: /** * Simple easy to use wrapper around addElement. * * Deal with simple validation rules. * * @param string $type * @param string $name * @param string $label * @param string|array $attributes (options for select elements) * @param bool $...


1

There is not straight forward solution for this. However you can certainly achieve this by 1. Register URL in xml 2. Create a page and copy template from thank you page of event. 3. Assign all the required variables to smarty template. HTH Pradeep


1

I just figured it out. When using the loadForm function you have to include at least 1 parameter in the URL. If you do not include a parameter then you will get the error. Is this a bug?


1

You are correct that postProcess runs too late. Consider the conventional request lifecycle for HTML_QuickForm/CRM_Core_Form: At the end of the Validate phase, it makes a major decision about whether to rerender the form with errors. However, the postProcess function is part of the Process phase which should only run on valid forms. The conventional way to ...


1

How are you saving the data? If you are using the api, then no there is no need to sanitize it, the api already guards against sql injection.


1

I'd do it like this: First get the name of the select element, and then get the elemement using this $element =& $form->getElement('name-of-select-element'); i.e. don't hard code that 4. You've got the options array correct, i.e. $element->_options Now you can just replace that options like you're doing, but depending on the widget in use it can ...


1

I always use the setDefaultValues() to add values to my form fields and boxes, like so: function setDefaultValues() { $defaults = array(); foreach ($this->_monthlyPattern as $number => $percentage) { $defaults['month'.$number] = $percentage; } return $defaults; }


1

Two suggestions: Do the setting in setDefaultValues() instead of buildQuickForm(). I find the "form data received by postProcess" often contains duplicates and miscellaneous other stuff and I'm sometimes not sure what to look at but usually use $this->_submitValues for visible fields. What are you examining?


Only top voted, non community-wiki answers of a minimum length are eligible