Variable number of individual entries in form entry

Alright, sorry for the new flood of topics but I really think these are pretty unique questions or at least are detailed enough that I’m not able to find the answer on other threads.

So what I’m trying to do is have a field in a form (such as in the Contracts module or one of my custom form modules) where the user is going to have a variable number of entries. For example, they may log anywhere between 5-15 blood pressure and heart rates at any given time. The time, blood pressure and heart rate will all need to be recorded but there is no pre-set number of them. So I was thinking of some feature on a module where they can click “+” to drop down and add a new line to the form and can add as many as they’d like. Are you guys familiar with any feature similar to this or have any ideas of how to accomplish this? Thanks a lot for your help.

@thelogos

Look at the solution https://github.com/salesagility/SuiteCRM/pull/8341
It’s repaired filed type collection of SuiteCRM.

2 Likes

You could also simply use a related module and have a subpanel for an unlimited number of measurements.

But the option provided above is probably the best one.

1 Like

Okay I’ll try it out and report back. Thanks.

Hi again,

So I added this module to the CRM and it appears in the module (I tested it for contact module), but I’m getting an AJAX failure warning from the browser and the module won’t load, but is continually trying to load. Any ideas how to address that?

This is what I’m getting in my error logs after following the steps to install the Collection module referenced earlier (Along with an “AJAX failure” dialogue box error in my browser):

[27-Dec-2020 03:23:27 UTC] PHP Deprecated: Array and string offset access syntax with curly braces is deprecated in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/Pear/Crypt_Blowfish/Blowfish.php on line 303
[27-Dec-2020 03:23:27 UTC] PHP Notice: Undefined property: ViewSugarFieldCollection::$type in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php on line 552
[27-Dec-2020 03:23:27 UTC] PHP Notice: Undefined property: ViewSugarFieldCollection::$type in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php on line 557
[27-Dec-2020 03:23:27 UTC] PHP Notice: Undefined property: ViewSugarFieldCollection::$type in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php on line 585
[27-Dec-2020 03:23:27 UTC] PHP Notice: Undefined property: ViewSugarFieldCollection::$type in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php on line 552
[27-Dec-2020 03:23:27 UTC] PHP Notice: Undefined property: ViewSugarFieldCollection::$type in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php on line 557
[27-Dec-2020 03:23:27 UTC] PHP Notice: Undefined property: ViewSugarFieldCollection::$type in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php on line 585
[27-Dec-2020 03:23:27 UTC] PHP Fatal error: Uncaught Error: Call to undefined method Link2::_get_link_table_role_field() in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php:155
Stack trace:
#0 /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php(132): ViewSugarFieldCollection->retrieve_values()
#1 /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/view.sugarfieldcollection.php(43): ViewSugarFieldCollection->setup()
#2 /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/MVC/Controller/SugarController.php(1087): require_once(’/home/thcepbkxg…’)
#3 /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/MVC/Controller/SugarController.php(468): SugarController->handleActionMaps()
#4 /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/MVC/Controller/SugarController.php(373): SugarController->process()
#5 /home/thcepbkxgq2c/public_html/portal.paraflight in /home/thcepbkxgq2c/public_html/portal.paraflight.aero/include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php on line 155

Hi, @thelogos

Please, show your files:

  • vardefs.php (both modules);
  • editviewdefs.php (which show the collection field);

Great. I’m just getting started with GitHub but they’re the only two files in my SuiteCRM repository. I’ve only tried this for the Contacts module so far so I only have two files.

@thelogos

Did you install the module BF_Connects?

I did install BF connects, yes.

@thelogos
Did you upgrade system files from the repository?

List og files:

  • include/SugarFields/Fields/Collection/CollectionDetailViewRow.tpl
  • include/SugarFields/Fields/Collection/CollectionEditViewRow.tpl
  • include/SugarFields/Fields/Collection/DetailView.tpl
  • include/SugarFields/Fields/Collection/EditView.tpl
  • include/SugarFields/Fields/Collection/SugarFieldCollection.php
  • include/SugarFields/Fields/Collection/ViewSugarFieldCollection.php
  • jssource/src_files/include/SugarFields/Fields/Collection/SugarFieldCollection.js

Sorry for the delay, have put this issue to the side for a few weeks, but yes I did all of that and still getting the AJAX failure warning from the browser.

@thelogos

I looked at the file vardefs.php again. You made two arrays fields but it isn’t correct. You should insert the fields bf_connects and collection_bf_connects to the first array fields

I am making new version now it will be easier to use.

1 Like