Hi,
I have created a form which send data via curl, to a webform on vtiger and it works.
But now I need to have a dropdown with key numeric and textual value to be filled in by reading the db and filtered according to another field, but I need to send to the field vtiger the text value and not the key. How can you make?
For example it is possible in the "Field maps" to indicate instead
label: Record type = cf_891
something like
label: Record type = cf_891.value
which allows to retrieve the value "value" of the field cf_891.
Alternatively, you can make sure that when you select an item in a dropdown, the corresponding value displayed is stored in another field that I would use to pass the value to vitiger?
thanks
Best regards
Nina
I have created a form which send data via curl, to a webform on vtiger and it works.
But now I need to have a dropdown with key numeric and textual value to be filled in by reading the db and filtered according to another field, but I need to send to the field vtiger the text value and not the key. How can you make?
For example it is possible in the "Field maps" to indicate instead
label: Record type = cf_891
something like
label: Record type = cf_891.value
which allows to retrieve the value "value" of the field cf_891.
Alternatively, you can make sure that when you select an item in a dropdown, the corresponding value displayed is stored in another field that I would use to pass the value to vitiger?
thanks
Best regards
Nina
Hi Bob,
it should be the right direction, now I have to check my skills in the use of Handle Arrays.
Thanks!
Nina
it should be the right direction, now I have to check my skills in the use of Handle Arrays.
Thanks!
Nina
Dear Bob,
I tried to use the code shown in the FAQ, but without success.
In a form called "person", I have a dropdown cf_705 field that shows a series of value:
1 = Abruzzo
2 = Tuscany
....
20 = Sardinia
The user selects, for example, the "Sardinia" and , on Submit, it is saved in the database the value 20 corresponding to Sardinia.
The FAQ refers to the array of form data, but it is not explained how to retrieve the value of a single field (eg. Cf_705) present in the form
On the basis of what is written in the FAQ, I added in the "On Submit" event of form "person" a "Custom code", with this code:
This code does not work. How can I change it so that the variable "cf_705_regione" is assigned the value "Sardinia" selected by the user?
I'm fine with that in the db will save the corresponding value 20.
I apologize for my english, but I'm using a translator
With best regards,
Nina
I tried to use the code shown in the FAQ, but without success.
In a form called "person", I have a dropdown cf_705 field that shows a series of value:
1 = Abruzzo
2 = Tuscany
....
20 = Sardinia
The user selects, for example, the "Sardinia" and , on Submit, it is saved in the database the value 20 corresponding to Sardinia.
The FAQ refers to the array of form data, but it is not explained how to retrieve the value of a single field (eg. Cf_705) present in the form
On the basis of what is written in the FAQ, I added in the "On Submit" event of form "person" a "Custom code", with this code:
<? php
$ form-> data ['cf_705_regione "] = $ form-> data [' cf_705 '];
?>
I need to assign it to the variable "cf_705_regione", the value "Sardinia" selected instead of the key value 20.
This code does not work. How can I change it so that the variable "cf_705_regione" is assigned the value "Sardinia" selected by the user?
I'm fine with that in the db will save the corresponding value 20.
I apologize for my english, but I'm using a translator
With best regards,
Nina
Hi Nina,
Hard to say, the PHP snippet you posted here is incomplete and it has extra spaces and mis-matched quotes :-(
Is that what you are using or have you re-typed it here? Please cut and paste all of the code from your Custom Code action.
Bob
Hard to say, the PHP snippet you posted here is incomplete and it has extra spaces and mis-matched quotes :-(
Is that what you are using or have you re-typed it here? Please cut and paste all of the code from your Custom Code action.
Bob
Hi Bob,
this is the code in Custom Code action:
<?php
$form->data["publicid"] = "xxxxxxxxxx";
$form->data["cf_705_regione"] = $form->data['cf_705'];
?>
This is the code in the Curl Action
publicid=publicid
firstname=firstname
lastname=lastname
label:Regione di nascita=cf_705_regione
--------------------------------------------------------------------------------------------------
That's it.
Thanks for availability
Best regards
this is the code in Custom Code action:
<?php
$form->data["publicid"] = "xxxxxxxxxx";
$form->data["cf_705_regione"] = $form->data['cf_705'];
?>
This is the code in the Curl Action
publicid=publicid
firstname=firstname
lastname=lastname
label:Regione di nascita=cf_705_regione
--------------------------------------------------------------------------------------------------
That's it.
Thanks for availability
Best regards
HI Nina,
Please check the FAQ again - there is nothing in your code that will replace '20' with 'Sardinia'.
Bob
Please check the FAQ again - there is nothing in your code that will replace '20' with 'Sardinia'.
Bob
Gent.mo Bob,
I hope you have the patience to follow me, because I'll try to explain.
In the form "person" there is a dropdown called cf_705 populated with the following options (Italian regions):
1=Piemonte
2=Valle d'Aosta
3=Lombardia
4=Trentino-Alto Adige
5=Veneto
6=Friuli-Venezia Giulia
7=Liguria
8=Emilia-Romagna
9=Toscana
10=Umbria
11=Marche
12=Lazio
13=Abruzzo
14=Molise
15=Campania
16=Puglia
17=Basilicata
18=Calabria
19=Sicilia
20=Sardegna
If a user chooses Sardegna it saved in the db table the corresponding value 20 and that's okay.
Now, as I use the same form to send data to the CRM system (vtiger), I added an event Curl up with this code:
publicId = publicId
firstname = firstname
lastname = lastname
label: Regione di Nascita = cf_705_regione
Before this event I added a "Custom Code" to assign the publicId the webform on CRM and in this same code I would make sure that instead of 20 were passed to the field "label: Regione di nascita" the value 'Sardegna' associated with the value selected for the dropdown cf_705.
If I write:
<? php
$ form-> data ['publicId "] =" xxxxxxxxxx ";
$ form-> data ['cf_705_regione "] =' Sardegna ';
?>
This works, but I would make sure that the value was assigned to cf_705_regione in a dynamic way, that was taken the value selected by the user in the field cf_705 (the user may select Sardegna or Toscana or Lazio, etc..).
I then modified the code in question in this way:
<? php
$ form-> data ['publicId "] =" xxxxxxxxxx ";
$ form-> data ['cf_705_regione "] = $ form-> data [' cf_705 '];
?>
This code does not work, the question is:
is there a way to assign a cf_705_regione the value selected by the user Sardegna, Toscana, Lazio or etc.. with the dropdown called "cf_705"?
I hope I explained better.
Thanks a lot.
Best regards,
Nina
I hope you have the patience to follow me, because I'll try to explain.
In the form "person" there is a dropdown called cf_705 populated with the following options (Italian regions):
1=Piemonte
2=Valle d'Aosta
3=Lombardia
4=Trentino-Alto Adige
5=Veneto
6=Friuli-Venezia Giulia
7=Liguria
8=Emilia-Romagna
9=Toscana
10=Umbria
11=Marche
12=Lazio
13=Abruzzo
14=Molise
15=Campania
16=Puglia
17=Basilicata
18=Calabria
19=Sicilia
20=Sardegna
If a user chooses Sardegna it saved in the db table the corresponding value 20 and that's okay.
Now, as I use the same form to send data to the CRM system (vtiger), I added an event Curl up with this code:
publicId = publicId
firstname = firstname
lastname = lastname
label: Regione di Nascita = cf_705_regione
Before this event I added a "Custom Code" to assign the publicId the webform on CRM and in this same code I would make sure that instead of 20 were passed to the field "label: Regione di nascita" the value 'Sardegna' associated with the value selected for the dropdown cf_705.
If I write:
<? php
$ form-> data ['publicId "] =" xxxxxxxxxx ";
$ form-> data ['cf_705_regione "] =' Sardegna ';
?>
This works, but I would make sure that the value was assigned to cf_705_regione in a dynamic way, that was taken the value selected by the user in the field cf_705 (the user may select Sardegna or Toscana or Lazio, etc..).
I then modified the code in question in this way:
<? php
$ form-> data ['publicId "] =" xxxxxxxxxx ";
$ form-> data ['cf_705_regione "] = $ form-> data [' cf_705 '];
?>
This code does not work, the question is:
is there a way to assign a cf_705_regione the value selected by the user Sardegna, Toscana, Lazio or etc.. with the dropdown called "cf_705"?
I hope I explained better.
Thanks a lot.
Best regards,
Nina
Hi Nina,
This code does nothing useful :-(
You need to use the code from the FAQ to look up the value 'Sardinia' from the returned value.
Bob
This code does nothing useful :-(
<? php
$ form-> data ['publicId "] =" xxxxxxxxxx ";
$ form-> data ['cf_705_regione "] = $ form-> data [' cf_705 '];
?>
You need to use the code from the FAQ to look up the value 'Sardinia' from the returned value.
<?php
$color_array = array(
1 => 'green',
2 => 'blue',
3 => 'red',
4 => 'white'
);
$form->data['color_name'] = $color_array[$form->data['color']];
?>
Bob
Hello Bob,
I thank you for the response. Perhaps it is not clear that I am using very little from Chronoform, I started with the new version and I find it difficult to apply the tutoriak if the examples are not explained step by step.
I analyzed the code in question, but I am not clear where it's going on.
If the options were to be loaded from db, the code is still valid? How to be modified?
I'm sorry, is several days that I try to solve a problem seemingly trivial.
Thank you for your attention.
Best regards,
Nina
Ps: I apologize for my English, I need to use a translator
I thank you for the response. Perhaps it is not clear that I am using very little from Chronoform, I started with the new version and I find it difficult to apply the tutoriak if the examples are not explained step by step.
I analyzed the code in question, but I am not clear where it's going on.
If the options were to be loaded from db, the code is still valid? How to be modified?
I'm sorry, is several days that I try to solve a problem seemingly trivial.
Thank you for your attention.
Best regards,
Nina
Ps: I apologize for my English, I need to use a translator
This topic is locked and no more replies can be posted.