multipart form field like email address

post #36546 I posted MultiTextField.zip here

madhatt30

Ok Thank you sir.

You might also find this resource very helpful, I know it is desined for SugarCRM but it really helped me in trying to understand the inner workings of creating a custom field type. SugarCRM Tutorial: How to Create a Re-Usable SugarField

Ok, so I have updated the MultiPhoneFields, Installable Module Biggest changes are as follows

  1. Better Code Organization and Extensive Source Code Commenting Where clarity was an issue (This should make it easier for others to make modifications)
  2. Added a field for Phone Extensions

Ok so here is an issue with the Multipart Phone Field
Putting more than one of these on will not work. So of course that wouldnā€™t work for me. So I updated the code to support multiple fields :slight_smile:

Why is this important? if you are like me and you want to customize the code and you happen to need more than one of these field types now you can have it.

[color=#004488]LATEST UPDATE[/color]

Hi,

  Very thank you sir, it is very useful with me sir.

Regrds,
Rajkumaranbu.

Hi,

Just downloaded this to use separately to a finished solution weā€™ve already got implemented with ExtendedPhone
Iā€™m looking at the code and wondering which bits to remove, so that the phone call type is removed, as well as the radio button, checkbox, and the words Main & Donā€™t call.
I need to put some code in also so that the Max Length is 8 Characters, but I can think I can do that bit.

Many Thanks
Mitchell

This is to madhatt30

Thank you. This works, but the list of phones that you are going to call say ā€œTitle: Managerā€ inside the contactā€™s field, prompting me misleadingly to only enter the title.

So I am going to call and say, ā€œHello Manager. I am calling to ask if you are ready to make the purchase of our $50,000 service package?ā€ Come on. Think through it. You need the name of the person and the title.Ideally that field could remain as it is, but without the misplaced prompt. It should say ā€œContactā€ or ā€œContact name/titleā€. I will try to change it.

Forum mistainkly does not refer to the post I hit reply fromā€¦ This was to madhatt30
PLEASE FIX THIS!

The last one you uploaded loads, but when adding a field it does not save, just says error.

1 Like

I think you can change this in DropDown lists in Studio. You can at least for Standard Relate fields, not sure about being able to do the same on this custom module.

can you please share the plugin. I intend to add fields which contain multiple entries, specially text (not only phone number)

Hi buddy, can you please share with us the updated plugin. I need dynamic text field (like the phone field you shared), so that I can enter multiple values in a field

But the MultiTextField takes only type phone numbers

Hii, did you find any way to do it.

I also need to collect and save multiple urls via such single field.

Thanks,

Hey Madhat, this is a great idea and not sure why this hasnā€™t become part of the core Suite/Sugar implementations, especially the Extended Text field, congrats and thanks for all the work youā€™ve done on this. Iā€™m having a problem with the installation of this module? Running Suite 7.9.9, PHP 7.0 on a Bitnami stack. The package installs fine, however when I attempt to create a Dynamic Phones type field I am returned an error on save. Looking through my logs it appears there is an SQL problem:

Cannot create column Query Failed: ALTER TABLE accounts_cstm add COLUMN phone_nums_c dynamicphonefield NULL : MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ā€˜dynamicphonefield NULLā€™ at line 1

Further entries in my log and back trace are as follows:

Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][DEBUG] Hook called: ::server_round_trip
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][DEBUG] Calling MySQLi::disconnect()
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][FATAL] Exception handling in /mysuiteinstall/include/MVC/Controller/SugarController.php:402
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][FATAL] backtrace:
#0 /mysuiteinstall/include/database/DBManager.php(353): sugar_die(ā€˜Database failurā€¦ā€™)
#1 /mysuiteinstall/include/database/DBManager.php(328): DBManager->registerError(ā€˜Cannot create cā€¦ā€™, ā€˜Cannot create cā€¦ā€™, true)
#2 /mysuiteinstall/include/database/MysqliManager.php(160): DBManager->checkError(ā€˜Cannot create cā€¦ā€™, true)
#3 /mysuiteinstall/modules/DynamicFields/DynamicField.php(657): MysqliManager->query(ā€˜ALTER TABLE accā€¦ā€™, true, ā€˜Cannot create cā€¦ā€™)
#4 /mysuiteinstall/modules/DynamicFields/templates/Fields/TemplateField.php(566): DynamicField->addFieldObject(Object(TemplateText))
#5 /mysuiteinstall/modules/ModuleBuilder/controller.php(430): TemplateField->save(Object(DynamicField))
#6 /mysuiteinstall/include/MVC/Controller/SugarController.php(523): ModuleBuilderController->action_SaveField()
#7 /mysuiteinstall/include/MVC/Controller/SugarController.php(491): SugarController->do_action()
#8 /mysuiteinstall/include/MVC/Controller/SugarController.php(465): SugarController->handle_action()
#9 /mysuiteinstall/modules/ModuleBuilder/controller.php(108): SugarController->process()
#10 /mysuiteinstall/include/MVC/Controller/SugarController.php(373): ModuleBuilderController->process()
#11 /mysuiteinstall/include/MVC/SugarApplication.php(105): SugarController->execute()
#12 /mysuiteinstall/index.php(52): SugarApplication->execute()
#13 {main}

ANY light you can shine on what might be the cause would be greatly appreciated, thank you for your time and patience

Sorry, appear to be 2 different streams for this - I posted on the other as wellā€¦, I have the same problem as recraig, canā€™t save a new Extended Phones type field. SQL error. Other post from https://suitecrm.com/suitecrm/forum/suitecrm-7-0-discussion/3716-multipart-form-field-like-email-address?start=30#69138

Hey Madhat, this is a great idea and not sure why this hasnā€™t become part of the core Suite/Sugar implementations, especially the Extended Text field, congrats and thanks for all the work youā€™ve done on this. Iā€™m having a problem with the installation of this module? Running Suite 7.9.9, PHP 7.0 on a Bitnami stack. The package installs fine, however when I attempt to create a Dynamic Phones type field I am returned an error on save. Looking through my logs it appears there is an SQL problem:

Cannot create column Query Failed: ALTER TABLE accounts_cstm add COLUMN phone_nums_c dynamicphonefield NULL : MySQL error 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ā€˜dynamicphonefield NULLā€™ at line 1

Further entries in my log and back trace are as follows:

Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][DEBUG] Hook called: ::server_round_trip
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][DEBUG] Calling MySQLi::disconnect()
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][FATAL] Exception handling in /mysuiteinstall/include/MVC/Controller/SugarController.php:402
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][FATAL] Exception in Controller: Database failure. Please refer to suitecrm.log for details.
Wed Jul 11 11:14:14 2018 [17177][b727f34d-f5e6-2364-d4de-5876c6f655ae][FATAL] backtrace:
#0 /mysuiteinstall/include/database/DBManager.php(353): sugar_die(ā€˜Database failurā€¦ā€™)
#1 /mysuiteinstall/include/database/DBManager.php(328): DBManager->registerError(ā€˜Cannot create cā€¦ā€™, ā€˜Cannot create cā€¦ā€™, true)
#2 /mysuiteinstall/include/database/MysqliManager.php(160): DBManager->checkError(ā€˜Cannot create cā€¦ā€™, true)
#3 /mysuiteinstall/modules/DynamicFields/DynamicField.php(657): MysqliManager->query(ā€˜ALTER TABLE accā€¦ā€™, true, ā€˜Cannot create cā€¦ā€™)
#4 /mysuiteinstall/modules/DynamicFields/templates/Fields/TemplateField.php(566): DynamicField->addFieldObject(Object(TemplateText))
#5 /mysuiteinstall/modules/ModuleBuilder/controller.php(430): TemplateField->save(Object(DynamicField))
#6 /mysuiteinstall/include/MVC/Controller/SugarController.php(523): ModuleBuilderController->action_SaveField()
#7 /mysuiteinstall/include/MVC/Controller/SugarController.php(491): SugarController->do_action()
#8 /mysuiteinstall/include/MVC/Controller/SugarController.php(465): SugarController->handle_action()
#9 /mysuiteinstall/modules/ModuleBuilder/controller.php(108): SugarController->process()
#10 /mysuiteinstall/include/MVC/Controller/SugarController.php(373): ModuleBuilderController->process()
#11 /mysuiteinstall/include/MVC/SugarApplication.php(105): SugarController->execute()
#12 /mysuiteinstall/index.php(52): SugarApplication->execute()
#13 {main}

ANY light you can shine on what might be the cause would be greatly appreciated, thank you for your time and patience

Hey MadHat the MultiTextFields.zip file appears to be the MultiPhoneField fileā€¦ same drop down and interface in Studio. Any chance you can upload the MultiTextFields file? Would be greatly appreciated, real solid add on functionality for Suite

Thanks for your time and patience

Not sure if anyone else is still looking at this functionality. Iā€™ve done a bit of work on what was provided by MadHat (thanks much for that) - added images so that you can see the differencesā€¦ different layout and dropped/changed some of the attributes, Iā€™m currently using it for storing multiple business namesā€¦

The downside with the field/module as it stands is that the drop down values it uses are hard coded. Iā€™m trying to create a drop down selection box (in Studio) in the multitextfield.tpl file. As you can see in the image attached (studio.png) the drop down box is present however it is NOT pre-loaded with selectable drop down list values. There is also a bit of code missing that assigns the selected drop down list to the field.

I have looked EVERYWHERE that I can think of to find code that will show me what is missing, javascript that loads the dropdown? onchange javascript? etc but canā€™t find anything to help. If ANYONE has any pointers to the required code, it would be greatly appreciated. Code I located to load the drop down (enum.tpl) is below

Thanks for your time and patience


<tr>
	<td class='mbLBL'>{sugar_translate module="DynamicFields" label="LBL_DROP_DOWN_LIST"}:</td>
	<td>
	{if $hideLevel < 5 && empty($vardef.function)}
		{html_options name="options" id="options" selected=$selected_dropdown values=$dropdowns output=$dropdowns onChange="ModuleBuilder.dropdownChanged(this.value);"}{if !$uneditable}<br><input type='button' value='{sugar_translate module="DynamicFields" label="LBL_BTN_EDIT"}' class='button' onclick="{literal}if(check_form('popup_form')) { ModuleBuilder.moduleDropDown(this.form.options.value, this.form.options.value); }{/literal}">&nbsp;<input type='button' value='{sugar_translate module="DynamicFields" label="LBL_BTN_ADD"}' class='button' onclick="{literal}if(check_form('popup_form')) { ModuleBuilder.moduleDropDown('', this.form.name.value); }{/literal}">{/if}
	{else}
		<input type='hidden' name='options' value='{$selected_dropdown}'>{$selected_dropdown}
	{/if}
	</td>
</tr>

Studio View


Detail View


Edit View

Hi,

I installed MultiTextFields and have this problem:

It shows the phone numbers twice.
Only happen in detail view, the rest are working fine.
Do you have some idea of what is going on?

Thank you.

Hi,

I solved it.
Just delete this from include/SugarFields/Fields/Multitextfield/DetailView.tpl:

{$item.0}
{$item.1}
{$item.2}
{$item.3}

Should be like this:

{php}
global $current_language; $app_list_strings = return_app_list_strings_language($current_language);
$this->assign(ā€˜APP_LISTā€™, $app_list_strings[ā€˜phone_type_domā€™]);
{/php}

{assign var=texts value="^|^"|explode:{{sugarvar key=ā€˜valueā€™ string=true}}}

{foreach name=outer item=text from=$texts}
{assign var=item value="^,^"|explode:$text}
{if $item.2 == ā€˜1ā€™}
{$item.0}
{else}
{$item.0}
{/if}
{if $item.1 == ā€˜1ā€™}Ā ({$APP.LBL_PHONE_MAIN}){/if}
{if $item.2 == ā€˜1ā€™}Ā ({$APP.LBL_PHONE_DONT_CALL}){/if}
Ā ({assign var=it value=$item.3}{$APP_LIST.$it})


{/foreach}

Then restart apache2 and run the quick repair and rebuild from suite crm.

Tadaa:

Bye.