Hello,
yes , phoneNumber => '0345566'. must work,
but as you have multiple phoneNumber, you need to send as array and as phoneNumberData field.
open googlechrome (F12), and see payload when you add multiple phonefield.
Web-to-lead capturing home and mobile number : store data to field with list optins
Collapse
X
-
Thank you, that's interesting you say it should be phoneNumberData
Code:{ "firstName": "FIRST_NAME", "lastName": "LAST_NAME", "emailAddress": "EMAIL_ADDRESS", "addressStreet": "ADDRESS_STREET", "addressStreet2": "ADDRESS_STREET2", "addressCity": "ADDRESS_CITY", "addressPostalCode": "ADDRESS_POSTAL_CODE", "addressState": "ADDRESS_STATE", "addressCountry": "ADDRESS_COUNTRY", "phoneNumber": "PHONE_NUMBER", <---- "facebook": "FACEBOOK", "twitter": "TWITTER", "description": "DESCRIPTION", "dateofbirth": DATEOFBIRTH }
Does the syntax " phoneNumber => 'value' " work in Javascript on a web page ?Last edited by timconsidine; 03-07-2021, 08:13 AM.Leave a comment:
-
Hello,
emum is as a string : name => 'coucou' .. .so for enum : enumfield => 'value'
for phoneNumber.. it's not as you have write. i give sample for back-end how is.
for one phone : phoneNumber => 'value'
but you have 2 phone, so i think you must send from client side data so to api and respect "phoneNumberData" as name of fieldData :
phoneNumberData => { [phoneNumber => .... ], [ phoneNumber] => ... }
Leave a comment:
-
Also (i think) related
I have a custom field contactType defined as a checklist with four options
I would like to add this to the web-to-lead payload something like this
(no wed form input element, static value determined by the page the visitor is on)
Code:var payloadData = { contactType: "Type 2", .... .... }
What is the correct syntax for assigning a value to e.g. the 2nd item in a checklist ?Leave a comment:
-
This gives me 500 error from espo web-to-lead link
Code:phoneNumber: { "phoneNumber": webToLeadFormElement.phoneNumber.value, "type": "Home", "primary": true}, phoneNumber: { "phoneNumber": webToLeadFormElement.mobileNumber.value, "type": "Mobile", "primary": false}
Leave a comment:
-
Ah ok, thank you
So the data is passed as an object.
Still struggling with this as javascript in the browser (don't have PHP on the webserver as it is going into a static HUGO site)
Leave a comment:
-
Hello,
see this :
PHP Code:$o = (object) [ 'phoneNumber' => $phoneMobile, 'type' => 'Mobile', 'primary' => true,]; $phoneNumberData[] = $o; $o = (object) [ 'phoneNumber' => $phoneHome, 'type' => 'Home', 'primary' => false,]; $phoneNumberData[] = $o;
'phoneNumberData' => $phoneNumberData,
Leave a comment:
-
Web-to-lead capturing home and mobile number : store data to field with list optins
Hi
I am making use of the excellent web-to-lead facility and instructions using web browser only code (https://docs.espocrm.com/administration/web-to-lead/)
Working fine for "standard" fields, but I want to capture both home and phone fields.
I've adjusted the form to do so, but I am not sure of the syntax/format to use for the payload in the script.
E.g.
var payloadData = {
firstName: webToLeadFormElement.firstName.value,
lastName: webToLeadFormElement.lastName.value,
emailAddress: webToLeadFormElement.emailAddress.value,
phoneNumber['Home']: webToLeadFormElement.phoneNumber.value
phoneNumber['Mobile']: webToLeadFormElement.mobileNumber.value
};
I can't trace in the forum or documentation how to reference a list item in a field
Any help please ?
Many thanks.
Tags: None
Leave a comment: