Forums

email action in ccv5

teldrive 06 May, 2014
Hi , if someone can help me
I could implement additional code action called "new" using addbutton function
$this->view->Toolbar->addButton("toolbar-button-add","http://myweb/es/component/chronoconnectivity5/?cont=lists&ccname=gestion_evaluators_list&act=new","NUEVO", "http://myweb/libraries/cegcore/assets/images/toolbar/add.png", "link"); 

my doubt is with another action called "email", i need for example send an email to 4 selected records
How does " email_form" know the number of selected records?
[attachment=0]Captura.JPG[/attachment]
GreyHead 07 May, 2014
Hi teldrive,

I think that the Dynamic to will accept a comma separated list of Email addresses.

Bob
Max_admin 07 May, 2014
Hi,

Instead of using "link" at the button call, please use "submit_list", that will post the checkboxes values.

Now you will need to connect your "email" action in CC to a CF event, call it email, and insert a "debugger" action to check the passed data!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 07 May, 2014
Thanks Max by your answer, I didn't get yet
Bob I tried with "submit_lis" but only I could get it working with "submit_selectors", here is the code of this button
$this->view->Toolbar->addButton("toolbar-button-apply","http://mywebpage/es/component/chronoconnectivity5/?cont=lists&ccname=gestion_evaluators_list&act=email", "EMAIL", "http://mywebpage/libraries/cegcore/assets/images/toolbar/email.png", "submit_selectors"); 

the issue not solved yet is how to get email fields of selected boxes passed, of couse I can get them with dbase read But I asume I am missing a more easier method
Array
(
    [cont] => lists
    [ccname] => gestion_evaluators_list
    [act] => email
    [srch] => 
    [fltr] => Array
        (
            [ator] => Array
                (
                    [codpostal] => 
                )

        )

    [limit] => 30
    [ator] => Array
        (
            [2] => Array
                (
                    [ecoord] => 1
                    [egrupo] => 1
                )

            [3] => Array
                (
                    [ecoord] => 0
                    [egrupo] => 1
                )

            [4] => Array
                (
                    [ecoord] => 0
                    [egrupo] => 1
                )

            [7] => Array
                (
                    [ecoord] => 0
                    [egrupo] => 1
                )

        )

    [gcb] => Array
        (
            [0] => 2
            [1] => 3
            [2] => 4
        )

)
teldrive 07 May, 2014
Hi Max, I have a doubt, I have tried to use "button_id" -> "toolbar-button-apply" for email action guessing that it should work , but it is not true
always get this error after submit button
Forbidden

You don't have permission to access /es/component/chronoconnectivity5/ on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

the issue is what "button_id" should I use for this action that calls to CF but doesn't return any field to CC
Max_admin 09 May, 2014
Hi teldrive,

Yes, its "submit_selectors", apologizes!🙂

Please try to add a new "Connection action" to the top of the "on load" event of your form, then configure it, write your connection's name and in the action please write "edit".

Then add a "debugger", does this load the data of the selected boxes ?

The first param in the "addButton" function is just the button id, don't worry about this.

What matters is the "act" in the link, you will need to create an action in your connection to match it if its not there, then connect it to your form!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 09 May, 2014
Hi Max no resuls so far
let me explain you tests I've done:
[attachment=0]Captura0.JPG[/attachment]
first without connection action on CF:
when email button is selected I receive on CF array of index of selected boxes
[attachment=0]Captura0.JPG[/attachment]
when select edit button array full of data is received on CF
[attachment=2]Captura4.JPG[/attachment]
when i insert connection action on CF( both cases) I've got error
[attachment=3]Captura3.JPG[/attachment]
[attachment=4]Captura4.JPG[/attachment]
Imade some adttional testing changing action "email or edit" action con connection-action in order to match values of "act" button, i tested with both
$this->view->Toolbar->addButton("toolbar-button-apply","http://mywebpage/es/component/chronoconnectivity5/?cont=lists&ccname=gestion_evaluators_list&act=email", "EMAIL", "http://mywebpage/libraries/cegcore/assets/images/toolbar/email.png", "submit_selectors"); 
teldrive 09 May, 2014
[attachment=0]Captura2-error.JPG[/attachment]this the error when connection -action is inserted con CF and CC calls to CF through action button
Max_admin 09 May, 2014
Hi teldrive,

Ok, Please remove the "Connection action" we added, that was not a good idea.

Please add instead a "custom code" action and use the code below to get a list of emails:

<?php
$emails = \GCore\Models\ator::getInstance()->find("list", array("conditions" => array("id" => $form->data("gcb"))));
pr($emails);//print result


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 11 May, 2014
Hi Max, it gets the records Id's, but empty arrays, (?)
[attachment=0]Captura.JPG[/attachment]
[attachment=1]Captura2.JPG[/attachment]
Max_admin 12 May, 2014
Sorry, I forgot a small thing, please try this code instead:

<?php
$emails = \GCore\Models\ator::getInstance()->find("list", array("fields" => array("id", "email"), "conditions" => array("id" => $form->data("gcb"))));
pr($emails);//print result


Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
teldrive 12 May, 2014
Answer
:D You did it Max, it works perfect
thanks a lot
[attachment=0]Captura.JPG[/attachment]
inocampo 03 Dec, 2014
Hi Teldrive

Can you please load a imagen with the CFV5 setup, for more illustration?

Thank you!
teldrive 03 Dec, 2014
1 Likes
May be this can help
<?php
$emails=\GCore\Models\paper::getInstance()->find("list", array("fields" => array("id", "email"), "conditions" => array("id" => $form->data("gcb"))));
$form->data['emailg']=implode(",",$emails);
?>


emailg is a text box field that allow insert more mails
after that you have to insert it into email action
[attachment=0]Captura.JPG[/attachment]
inocampo 03 Dec, 2014
Thank you alot

If I need to do an UPDATE to the rows of ARRAY you know how?

Thank you
teldrive 03 Dec, 2014
explain better what do you want to do
inocampo 03 Dec, 2014
Ok

I need a new action button, where I select anything rows and when i make click in the new button

1. An INSERT in the table "table1" take the last_insert.
2. This last_inser go to "table2" make an UPDATE in 3 fields (manifest_binary 1/0) (manifest_date: today) and (manifest = last_insert).
3. Redirect URL

Thank you
teldrive 03 Dec, 2014
when action requires several fields processing i recomend to use CF action from CC so you will need call to one form
inocampo 03 Dec, 2014
thank you, I solved
cornelio 13 Dec, 2014
Hi,

I followed line by line across this interesting discussion.
I tried to apply the same technique to send mail ... but my form (no results) remains empty!.

summary of what I did:

1) I added on my CC new Actions as "email" on Form Event I put the name of my form;
2) in toolbar-> I added the action ... & act = email

3) Custom code in the form I put:

   $ emails = \ gcore \ Models \ mssll :: getInstance () -> find ('list', array ('fields' => array ("id", "invia_email"), "conditions" => array ("id" => $ form-> data ("gcb"))));
     pr ($ emails); // print result


where "mssll" is my Model (note that my CC contains 5 Model and mssll is the first)

Best Regards

Elio
Max_admin 13 Dec, 2014
Hi Elio,

The code used is cases sensitive and you have many spaces which should not exist, please try to fix this!

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
cornelio 16 Dec, 2014
hi
I'm working on a list of records with CCV5 based on more 'modules, I'm using an Action with "submit_selectors".

using this code in a Custom
<?php
    $emails=\GCore\Models\my_model::getInstance()->find("list", array("fields" => array("my_model.id", "my_model.email"), "conditions" => array("id" => $form->data("gcb"))));
    $form->data['emailg']=implode(",",$emails);   
?>
I would call the field "email" but I noticed that if this field is not included in this figure first Model (email) is not called.
I tried to change the name of the Model, but nothing changes.

any advice on how to proceed?

otherwise No problem with a single Model, as this excellent topic

thanks so much

Elio
Max_admin 27 Dec, 2014
Hi Elio,

Sorry, I couldn't understand this, you mean that it works if "my_model" is your primary model but doesn't work in other situations ? please clarify or give examples.

You can always debug the results to check if the correct data is returned from the code.

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.