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.