Save Button in Leads Edit View not working

Hey everyone!

It seems that IĀ“ve become a ā€œvictimā€ :smiley: of a very mysterious bug, which has been around for quite some time:

The save button within the edit view of the Leads module is ā€“ quite simply ā€“ not working.
And the worst part is: there is no error in the console nor anything in the logsā€¦

Apparently someone in 2015 had the same strange thing happening: Leads save button not working
It ā€œwent awayā€ after a few weeks, but no cause was ever found.

Now, IĀ“ve already tried quite a fe things, including

  • quick repair
  • re-set the correct permissions
  • change the PHP version
  • update to 7.12.1
  • rebuild all and any available files
  • deactivate/activate AJAX components
  • check the logs and the console
  • tried multiple browsers (Safari, Chrome, Firefox), while disabling any content blockers, etc.

, but none of the aforementioned procedures led to a result. And the weirdest part is: it came without any specific warning/change. From one day to another the button simply stopped working, while it works perfectly fine in other modules (such as contacts).

Has anybody come across this issue (and potentially found a solution)?

Any help is appreciated :slight_smile: !

1 Like

Does this mean you did all the Javascript repairs from Admin / Repairs?

Yap, literally all of the available repair optionsā€¦

I donā€™t know if you are a developer, but can you attach a debugger and run through the request?

Or at least compare a case where it works with one where it doesnā€™t? Try to figure out if the problem is front-end or back-endā€¦

I still couldnĀ“t find the actual cause (IĀ“ll keep hunting), but for now IĀ“ve traced the ā€œproblematicā€ function back to the file

/include/Smarty/plugins/function.sugar_button.php

it now looks like this on line 359-362

    case "SAVE":
                $view = ($_REQUEST['action'] == 'EditView') ? 'EditView' : (($view == 'EditView') ? 'EditView' : $view);
                $output = '{if $bean->aclAccess("save")}<input title="{$APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{$APP.LBL_SAVE_BUTTON_KEY}" class="button primary" onclick="'.$js_form.' {if $isDuplicate}_form.return_id.value=\'\'; {/if}_form.action.value=\'Save\'; if(check_form(\'' . $formName . '\'))SUGAR.ajaxUI.submitForm(_form);return true;" type="submit" name="button" value="{$APP.LBL_SAVE_BUTTON_LABEL}" id="'.$type.$location.'">{/if} ';
            break;

In other words: IĀ“ve replaced ā€œSUGAR.ajaxUI.submitForm(_form);return false;ā€
with
ā€œSUGAR.ajaxUI.submitForm(_form);return true;ā€

So far this works like a charm, but obviously isnĀ“t a permanent solution, so maybe IĀ“ll come back with a better solution (as this just solves the symptoms, not the actual problem).

For others having a similar issue:

IĀ“ve found that some time ago cloudflareĀ“s ā€œRocketLoaderā€ was interfering with the !window.__cfRLUnblockHandlers function, so I thought this might be the issue; however in my case, disabling/enabling cloudflare made no difference (I use Cloudflare Teams for access control to specific web-applications); though it might be different in your case, so itĀ“s worth trying, if youĀ“re having the same issue.

1 Like

Nice work!

I wonder if itā€™s related to this change 3 years ago (the latest change on that file):

Maybe thereā€™s something up with that $formName = $params['form_id']; on the Leads screenā€¦

2 Likes