4 votes

Editing a label in "new individual" form

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.
Alan Dixon's user avatar
  • 6,766
4 votes

How do I upload files in a custom form?

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'...
Kainuk - CiviCooP's user avatar
3 votes
Accepted

QuickForm Error w/ CiviCRM 5.33.0

@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 ...
Seamus Lee's user avatar
  • 1,289
3 votes
Accepted

Settings Definition (How to Use On_Change?)

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 ...
Pradeep Nayak's user avatar
3 votes

Quickform Types Definitions or Examples

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 ...
ErikH - CiviCooP's user avatar
3 votes

Creating a custom Form: Action (view vs update)

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 ...
Pradeep Nayak's user avatar
3 votes

how to get list of all buttons in civicrm hook_buildform?

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' ...
Pradeep Nayak's user avatar
3 votes
Accepted

Blocking Double Click on Form Submit Button

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 ...
Sleewok's user avatar
  • 1,146
3 votes

Editing a label in "new individual" form

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/
KarinG - Semper IT's user avatar
3 votes
Accepted

Quickform: Set the "Selected" value in a select element

This is how you do it: CRM_Financial_BAO_FinancialType::getAvailableFinancialTypes($financialTypes, 3); $this->add('select', 'financial_type', ts('Financial Type'), $...
Sleewok's user avatar
  • 1,146
2 votes
Accepted

How do I find the contact ID on a checksum link, after a form is submitted?

Please have a look at the code here and see if it can help with what you need.
petednz - fuzion's user avatar
  • 28.2k
2 votes
Accepted

Adding validation: cannot use $this in formRule() of Form

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. ...
michaelmcandrew's user avatar
2 votes

Editing a label in "new individual" form

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 ...
ErikH - CiviCooP's user avatar
2 votes
Accepted

Help with QuickForm Image Upload

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.
Coleman's user avatar
  • 18.3k
2 votes
Accepted

Dynamically Change QuickForm on EntityRef selection

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->...
Sleewok's user avatar
  • 1,146
2 votes

Adding and storing form fields

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 ...
jitendra - fuzion's user avatar
2 votes
Accepted

Quickform AddEntityRef Errors 5.58

I suspect what you're seeing is a permissions problem. You mentioned it doesn't work for Front-End users but it does work on the back-end. EntityRef fields work by calling Apiv3 via ajax. For that to ...
Coleman's user avatar
  • 18.3k
2 votes

PEAR packages and PHP 7.4

I was updating from an early version of CiviCRM (4.7.30) to the latest one, together with an upgrade from Drupal 8.7 to 9.4. I had to do progressive updates i.e. to 5.26.2/8.8, then 5.51.3/8.8, then 5....
krystalcode's user avatar
2 votes
Accepted

Can't create quickform via CRM_Core_Form in my custom extension

Maybe it is not connected to your issue, but if you implement a form, it supposed to be inside a Form directory, and the class name should follow this (has to contain _Form_). In your case the class ...
akosgarai's user avatar
  • 283
2 votes
Accepted

Forms Question -- href issue

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="...
Norm Dressler's user avatar
1 vote

Display thank you message in QuickForm

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 ...
artfulrobot's user avatar
  • 3,920
1 vote

"QuickForm Error: nonexistent html element" on New Contacts (all types) - Joomla 3.9.22, CiviCRM 5.30.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 ...
Jon G - Megaphone Tech's user avatar
1 vote
Accepted

Quickform Types Definitions or Examples

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. * ...
Jon G - Megaphone Tech's user avatar
1 vote

Render a previously submitted event registration

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 ...
Pradeep Nayak's user avatar
1 vote
Accepted

LoadForm Popup - Uncaught TypeError: Cannot read property 'split' of undefined

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?
Sleewok's user avatar
  • 1,146
1 vote
Accepted

How to raise a form error in \CRM_Core_Form::postProcess()

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 ...
Tim Otten's user avatar
  • 5,684
1 vote
Accepted

Do I need to sanitize quickform inputs in a extension?

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.
Coleman's user avatar
  • 18.3k
1 vote

How to alter the options inside element of a civicrm new membership form?

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'...
Alan Dixon's user avatar
  • 6,766
1 vote

Why are my QuickForm checkboxes always ticked, in postProcess()?

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 => $...
ErikH - CiviCooP's user avatar
1 vote
Accepted

Why are my QuickForm checkboxes always ticked, in postProcess()?

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 ...
Demerit's user avatar
  • 22.5k

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