1. create a custom field, say “Loan Purpose” in the Leads module. In my forms, I’ll call this “loanpurpose”
2. Using phpmyadmin, browse to the Table: vtiger_leadscf
3. Look at the custom field name for the field in question – mine was called cf_453 This is the field name to be used in webforms.php
4. The name cf_453 only needs to be used in webforms.php, for the other files, call it something friendly – here I used loanpurpose.
5. assign like this:
index.php: add the field name loanpurpose to the line starting with: function create_lead_from_webform
In my implementation, used a drop down list in the form like this:
<tr><th>Loan Purpose:</th>
<td><select name="loanpurpose">
<option value="Purchase">Purchase</option>
<option value="Refi - Rate,Term">Refi - Rate,Term</option>
<option value="Refi - Cash-out">Refi - Cash-out</option>
<option value="Second">Second</option>
<option value="Other">Other</option>
</select></td>
</tr>
send_data.php: add the line(s) for the new field
'loanpurpose'=>"$loanpurpose"
webforms.php: Add in both places:
if($_REQUEST['create'] == 'lead') function:
$loanpurpose = $_POST['loanpurpose'];
and at
$params = array(
$focus->column_fields['cf_453'] = $loanpurpose; *<-- this is where the new form value gets mapped to the custom field ID.*
Any errors encountered will be from typo's, missing "." or "," after the new field entries, wrong field names or a missing addition - look for where the other fields are passed and that is the best start for troubleshooting.
Hi mochabomb,
great article. I am trying to run a function on a custom field when there is a keypress/onblur… I cant find the file with to enter the onblur event..wondering if you can point me in the right direction. much apreciated
The onblurb event would be in the index.php for that module – the one that is loading the form elements. Check that – in a test site and see if that works.