Forums

ChornoForm v4 and Jnews v 7.4.2

riga75 08 Nov, 2011
I used joomla 1.5 with chornoform v 3.2 and v JNews 7.3.7 and I used to integrate the code that you gave me that you entered in the component chonorforms, click on the name of the form form-code-On Submit code - before sending email: Insert the following code
<?php
$email = JRequest::getVar('Email', '', 'post');
$name = JRequest::getVar('CognomeNome', '', 'post');
$MyForm->formrow->redirecturl = JURI::base()."index.php?option=com_jnews&act=subscribe&listid=15&receive_html=1&email=$email&name=$name&passwordA=xxxx&redirectlink=http://www.tregima.it/email-inviata-home.html";
?>


Now with Joomla 1.7.2, chornoforms v4.0rc2.0 and JNews v 7.4.2 does not work anymore integration, ie when one is not redirected to fill out the form and the name and email address are not included in my list of newsletters
I came in the ChronoForms component, then edit wizard-event, I added custom code and I entered the same code.
What's wrong?

I searched the forums and I saw someone talking about using Curl, I tried looking but I have not understood anything.
Who can help me?
thanks

stefano
GreyHead 08 Nov, 2011
Hi riga75 ,

In CFv4 you can use the ReDirect URL action to build the URL and the ReDirect User to refirect the user to the URL. This would replicate the code here.

The CURL action would allow you to send the data to the JNews component 'behind the scenes' without sending the User there.

The configuration for both the cURL and ReDirect URL actions is very similar.

Bob
riga75 08 Nov, 2011
Sorry Bob, but I'm not very good at these things.
I put this code in CustomCode:
<?php
$email = JRequest::getVar('Email', '', 'post');
$name = JRequest::getVar('CognomeNome', '', 'post');
$MyForm->formrow->redirecturl = JURI::base()."index.php?option=com_jnews&act=subscribe&listid=15&receive_html=1&email=$email&name=$name&passwordA=xxxx";
?>

and then I add the form field and put the Redirect User ULR where the user must be redirected

But the problem is that no data is recorded in JNews 😟
GreyHead 08 Nov, 2011
Hi stefano,

Please check my last post. The CFv3 code won't work in CFv4.

Bob
riga75 08 Nov, 2011
and what should I use? thanks
GreyHead 08 Nov, 2011
Hi stefano,

In CFv4 you can use the ReDirect URL action to build the URL and the ReDirect User to refirect the user to the URL. This would replicate the code here.

The CURL action would allow you to send the data to the JNews component 'behind the scenes' without sending the User there.

The configuration for both the cURL and ReDirect URL actions is very similar.


Bob
riga75 08 Nov, 2011
thanks bob, very kind as always, you see so few examples that I understand how to configure curl?
GreyHead 09 Nov, 2011
Hi Stefan,

Here's the Help tab from the CURL [GH] action - not all these features are in the standard action but it should help:

This is an advanced cURL Action for ChronoForms v4 on Joomla! 1.5 & 1.6. It has the same basic functions as the standard Email Action but adds more features and uses slightly different code in the configuration.
The General tab

Enter the URL that you want to send the data to in the Target URL box. This must either be a valid URL (complete with the http:// or https:// prefix). If you leave the box empty it will default to the current site http://frances/Joomla1.7a/administrator/ Do not include any part of the URL after a '?'; add the query values to the Params/Fields map box instead e.g. option=com_acymailing.
The Params/Fields map is the main configuration box. Enter each data item that you want to send in this box using one line for each item. Each item takes the form of curl_parameter=some_value. You can use values from the form results by using the 'curly bracket' syntax {input_name}. Note: to set an empty parameter use the value NULL; lines with no value will be ignored.
For advanced use only: You can also set custom cURL options in the Params/Fields map box. They must come after the cURL parameters and after a line with just ##CURLOPTS## on it. Entries take the form of CURLOPT=value e.g. CURLOPT_URL=http://example.com
Here's an example of a set of entries:
banana=name
lettuce=email
apple={name}
beetroot={email}
##CURLOPTS##
CURLOPT_URL=http://example.com
CURLOPT_TIMEOUT=60
The Header in Response option will return the full header details on the cURL submission. Leave this set to 'No' unless you are de-bugging or know that you need the information as it may well show the whole of the responding web page!!


Bob
riga75 11 Nov, 2011
Hi Bob,

pardon my ignorance, but could you give me an example because I did not understand anything of what I should do.
thank you very much

stefano
GreyHead 11 Nov, 2011
Hi Stefano,

Step 1: Exactly what information do you need to pass to JNews?

Bob
riga75 11 Nov, 2011

Hi Stefano,

Step 1: Exactly what information do you need to pass to JNews?

Bob



Name and email address, and the two form fields are name1 and email
GreyHead 11 Nov, 2011
Hi Stefano,

In that case what you need in the cURL [GH] code box is
name={name1}
email={email}


But I'm pretty certain that isn't the full list of parameters.

Bob
riga75 12 Nov, 2011
In the target field url do I put?
Then after the redirect has to do and I have to use the Redirect URL field or Redirect User?
thanks
GreyHead 12 Nov, 2011
Hi Stefano,

You need to look at the JNews documentation and work out exactly what data needs to be sent.

The cURL setting are slightly different in the CURL [GH] action in CFv4 - the dynamic values go into the main box using curly brackets as I showed you in my last post.

Bob
riga75 17 Nov, 2011
Sorry to trouble yet, but I can not fix my problem.
I also asked for help to JNews forums and they told me this thing:

Hi Stefano,

Just please ask if having these params it should be working:

option=com_jnews
act=subscribe
name={CognomeNome}
email={email}
passwordA=xxxxxxx
fromSubscribe=1
listid=15
receive_html=1


or there are still things to do.

Kindly say/port in the forum that you have already provided the correct params but still after the subsmission of the form the subscription to jNews is still not called.

Kind Regards,
Mary



Could you help me? thanks
GreyHead 29 Nov, 2011
Hi riga75,

How does this differ from what you have in the cURL [GH] code box?

Bob
riga75 29 Nov, 2011
Hello Bob, now thanks to your help, "register" the data but does not redirect.
And I can not understand the "voice" Where can I find that you used?
GreyHead 29 Nov, 2011
Hi riga75,

Is debug still enabled? That stops the redirection and displays the link instead.

What 'voice'? I don't understand that question.

Bob
riga75 29 Nov, 2011
For the second question looks at the screnshot
[attachment=0]Mobili TreGima - Amministrazione.jpg[/attachment]
I have to keep the two items in the Curl? or just the one you've entered?
I enabled debugging now
GreyHead 29 Nov, 2011
Hi riga75,

The Custom Code action is used to set the variables needed by the cURL action.

Bob
riga75 29 Nov, 2011
Ok, but can not find among the available
riga75 29 Nov, 2011
I can not find the item Custom Code - Set cURL data
[attachment=0]dsfsdfsa.jpg[/attachment]
GreyHead 29 Nov, 2011
Hi Riga75,

It's a plain Custom Code action from the main 'Core Actions' group - with a label 'Set cURL data'.

Bob
riga75 02 Dec, 2011
Hello Bob,
I tried to do the same thing with other forms, but does not work .... no "record" data JNews
You can see where I went wrong?
thanks
GreyHead 02 Dec, 2011
Hi Riga75,

I can't see anything from here :-(

Bob
riga75 02 Dec, 2011
you always access the data. thanks
riga75 09 Dec, 2011
Hello Bob, excuse the trouble, you've had time to look at my problem?
I do not understand why it does not work with other forms .... I just copied and pasted the same thing that works in the form
GreyHead 16 Dec, 2011
Hi Stefano,

What do you want me to look at? I've just checked and the HomePage form is working correctly.

Bob
riga75 16 Dec, 2011
Hello Bob, the problem is in the other form that does not "register" the data inside JNews, I copied what you did but it does not work
GreyHead 16 Dec, 2011
Hi Stefano,

Which is the other form?

Bob
riga75 17 Dec, 2011
Try with "cucine"
GreyHead 17 Dec, 2011
Hi Stefano,

The Form HTML for the Cucine form was broken
<td><input type="text" title="Inserire un indirizzo Email corretto" class="validate['required','Email'] name="Email" />*</td>
There is a quote missing after the class attribute.

When that is fixed the form works OK.

Bob
vistech 28 Dec, 2011
Would someone mind posting a backup of a working form to integrate jnews and Chronoforms v4? That would be a huge help!
GreyHead 28 Dec, 2011
Hi vistech,

Here's a form tested in Joomla! 1.7 with CFv4 RC3.0 and JNews 7.4.0

I only have time to post the file now; I'll add some more notes later.

Later:

The form uses a Custom Code element for the checkboxes because JNews uses indexed array names like subscribed[1] that ChronoForms cannot easily replicate. The code for the Custom element is
<input type="checkbox" name="subscribed[1]" id="subscribed_1" title="" value="1" checked="checked" class="" />
<label for="subscribed_1">List 1</label>
<input type="checkbox" name="subscribed[2]" id="subscribed_2" title="" value="2" class="" />
<label for="subscribed_2">List 2</label>
This is copied from a ChronoForms Checkbox group apart from the [1] and [2].

There are two other standard ChronoForms text inputs named 'name' and 'email'.

In the ON Submit event there is a Custom Code action that is used to add the 'fixed' values into the form results array so that they are available to the following cURL action*. The code here is
<?php
$form->data['sub_list_id'] = array(1 => 17, 2 => 18);
$form->data['acc_level'] = array(1 => 0, 2 => 0);
$form->data['option'] = 'com_jnews';
$form->data['act'] = 'subscribe';
$form->data['receive_html'] = 1;
$form->data['redirectlink'] = '';
$form->data['listname'] = 1;
$form->data['passwordA'] = 'f4DITIdzhuZag';
$form->data['fromSubscribe'] = 1;
?>
You will need to change the password and probably some other values depending on the set up of your site and form.

Lastly there is a cURL action with a target url of the site root e.g. http://www.my_domain.com/index.php and a Params/Field map like this
option=option
act=act
name=name
email=email
subscribed=subscribed
sub_list_id=sub_list_id
acc_level=acc_level
redirectlink=redirectlink
listname=listname
passwordA=passwordA
fromSubscribe=fromSubscribe
Each of these lines has a JNews paramter name before the = sign and a name from the ChronoForms $form->data array after the = sign. In this case I've set them up so that both names are the same, they don't need to be but it helps to be consistent.

This form is a replica of the form from the JNews module. There are various other ways that you could construct a form - automatically subscribing to a single list for example; or offering HTML/Plain text as a check box. You can adjust the form to meet your needs.

This form submits using cURL after the main form is submitted whereas the JNews form uses Ajax. You could change the form easily to use an HHTP request before submission; or with more work to use Ajax.

Bob

*This is because the standard cURL action only accepts 'dynamic' values from the form data. If you use my custom cURL [GH] action which accpets both 'static' and 'dynamic' then you can combine most of the code from the Custom Code action into the cURL [GH] action.
pheugoo 17 Sep, 2012
uhm what am i missing?! where does that password come from?
GreyHead 17 Sep, 2012
Hi pheugoo,

If I remember correctly it was copied from the JNews module code.

Bob
This topic is locked and no more replies can be posted.