Save and Continue for selected Records

OK…thanks
Never done it before…

Can u paste me a short example of where to place it and how to override default “Save and Continue” button?

Thanks

@rainolf
Look at customCode of buttons in file: modules/Meetings/metadata/editviewdefs.php.
The code of the button Save and Continue is here: themes/SuiteP/include/EditView/actions_buttons.tpl

And you should remove default button Save and Continue using javascript.

Sorry,
tried with no luck.

Probably this kind of things is currently out of my knowledge.

Any help is kindly appreciate.

Thanks

Regarding:

SUGAR.saveAndContinueCustom = function (elem){
    elem.form.action.value='Save';
    sendAndRedirect('<name_of_form>', '{$app_strings.LBL_SAVING} {$module}...', '{$list_link}');
}

What about {$list_link}?
Trying to replicate your suggestion but when i click custom Save ad Continue it redirects me to:
index.php/ {$list_link}
because $list_link is not going to be expanded.

Thanks

@rainolf

It was interesting case for me. I found a simple solution. Don’t modify button. Add the code to the end of function display after parent::display();.

        if(!empty($this->ev->formName)){
            echo "<script type=\"text/javascript\">document.getElementById('".$this->ev->formName."').setAttribute('id', 'EditView');</script>";
        }

For me it works please check for you too.

Boom!!!
It works like a charm!

That’s crazy.

Really appreciate…honestly it was a big challenge for me!

Hope to don’t disturb you again…

Many thanks

Now the next challenge is to prevent default submit in Save and Continue if one filed is missing or value is not compliant…done for save button following this tutorial:
https://www.youtube.com/watch?v=cn6daqxA3Sw

Any suggestion is welcome!

@rainolf
It isn’t standard for SuiteCRM decision. I recommend to use javascript functions removeFromValidate() and addToValidate().

I’ve tried to insert a simple addToValidate just for test.

 addToValidate('EditView','reference_number','int',true,'TEST');

What i’ve seen after your modification is that Save and Continue is validating right while Save is throwing an error:

Uncaught TypeError: _form is null

This is related to changes in display function in order to avoid caching problems:
post:

$this->ev->formName='EditView_Mobile';

Not able to understand how i could fix this last issue

@rainolf

I checked again. Changing form id is not right way. Sorry.

Not a problem…appreciate your efforts

i am checking too

Hi, did you get any chance to find how we could solve the issue?

Thanks

@rainolf

I know how resolve the problem but I think that decision is not completely correctly. Main problem is that the file of html form uses the form name in the name itself. And the code of core SuiteCRM is using the form name EditView as a constant into a lot of objects. There is a contradiction in this situation. You should change the form name but you cann’t change it.

You can work around this problem if switch on/off developmen mode. The form file in cache will be building each times. I think that is bad solution but it will works.

public function display(){
    $_SESSION['developerMode']=true;
    parent::display();
    $_SESSION['developerMode']=false;
}

I think that the core code should be changed but it’s enought big job.

I agree with you, it sounds too much off compliance.
Let’s try to change the way we can achieve this.

In summary i need to change the number fileds to edit based on a ServiceType fileds value.
ex: when service type is Mobile only Mobile Number and ICCID will be visible while is Internet we will add Activation Address fileds.

In this way and after filtering the list view i can use Save ans Continue to make a sort of fast bulk edit for all records included in the filtered search.

Do you have any other possible way to do it without altering the core code and of course in an upgrade safe way?

Many thanks

@rainolf

  1. You can write custom code for backend (using action_view_map or entry_point) and frontend for loading fields using ajax. It’s a difficult task.
  2. You can write javascript and hidden or remove some fields. This is the worst decision.
  3. Switch on/off developer mode.It isn’t good solution but it’s safe solution.

I’ve tested your workaround and it works.

If nothing else is plausible then i could accept enabling temporary developer mode.

Thanks once again for your effort,

Appreciate