Curl Plugin 2 Field in one variable Problem

parp15 16 Jan, 2012
Hello to everyone.
I have a prolem with the Curl plugin.
I created a form with fields: nome, cognome and email.
I set the plugin to register the user in the JNews newsletter.
The plugin works properly.

I plugged in the field nome and email, name and email, which are the variables to send to JNews.
I put in the extra field needed to run the other options: action=subscribe etc.

My problem is that the plugin sends to JNews, the variable name, with only the field nome.
How can I do to unite the two field nome and cognome and send to JNews, the variable name=nome_cognome?
GreyHead 16 Jan, 2012
Hi parp15,

Use a Custom Code action to create a new form variable with the text you need.
<?php
$form->data['full_name'] = $form->data['nome'].' '.$form->data['cognome'];
?>
Then use full_name in the cURL box.

Bob
parp15 16 Jan, 2012
thanks Bob,
but I haven't understand where use the php code.
Where I have to write this code?
I have joomla 1.5.24.

I have test to wrote the code in to the extra code tab -> Extra before CURL code, on the Curl Plugin and I wrote: name=full_name in to the General tab -> Extra fields Data.

But when I go to read the registration on JNews, the user is saved with full_name and not with: nome cognome.

What's wrong?
GreyHead 16 Jan, 2012
Hi parp15,

Ah, you are using ChronoForms v3 - I Should have asked.

Add a hidden input to your form with the name 'full_name'. That will add an extra box to the cURL Plug-in setup.

In the Code Before cURL box add
<?php
$full_name = array();
$full_name[] = JRequest::getString('nome', '', 'post');
$full_name[] = JRequest::getString('cognome', '', 'post');
$full_name = implode(' ', $full_name);
JRequest::setVar('full_name', $full_name);
?>


Bob
parp15 16 Jan, 2012
Thanks Bob I have resolved.
I created a hidden inputbox then I updated the value through a javascript function.
Place the code if it helps someone.

Form Html:
<input tabindex="1" class="cf_inputbox required" maxlength="150" size="20" title="" id="text_13" name="nome" type="text" onChange="javascript:full_name_rewrite()"/>
<input tabindex="2" class="cf_inputbox required" maxlength="150" size="20" title="" id="text_15" name="cognome" type="text" onChange="javascript:full_name_rewrite()"/>
<div class='hidden'><input tabindex="2" maxlength="150" size="20" title="" id="f_name_hidden" name="full_name" type="text" /></div>

Function Jvascript:
function full_name_rewrite(){
var nome=document.getElementById('text_13').value;
var cognome=document.getElementById('text_15').value;
document.getElementById('f_name_hidden').value=nome+" "+cognome;
}

Css Code:
div.hidden {
visibility: hidden;}


I made ​​these changes to the tab:Form Code of the form, not of the plugin.
In the Plugin now also appears new Field full_name.
This topic is locked and no more replies can be posted.