close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Field ID Name Changes

Thread began 3/22/2012 10:23 am by drdocb | Last modified 3/24/2012 12:25 pm by Jason Byrnes | 837 views | 5 replies |

drdocb

Field ID Name Changes

I am using the latest Form Builder to create Web To lead for our Salesforce Account. Salesforce web interface requires their field names and generates an html template for you. I finally figured out why the form stops working everytime i modify and regenerate it in Form Builder and would love a way to stop this error.

The Salesforce Numerical ID's are being changed from leading 00 to _0 every time and I need to manually go through each one and correct it

example

<input id="0NE0000000mXHj" name="0NE0000000mXHj" type="text" value="" class="formTextfield_Medium" tabindex="15" />

Gets changed BACK to (see the leading 0 is repleced by an '_').

<input id="_0NE0000000mXHj" name="_0NE0000000mXHj" type="text" value=""
class="formTextfield_Medium" tabindex="15" />


This occurs even when the Name appears correct in the edit screen of Form Builder I have a screen shot just prior to the rebuild where the Name Field is 0NE0000000mXHj but after the form build the code is

<input id="_0NE0000000mXHj" name="_0NE0000000mXHj" type="text" value="" class="formTextfield_Medium" tabindex="15" />

So Salesforce does not equate the ID and I need to edit each one in Dreamweaver since it still appears as '00' in Form Builder


It appears Spry variables need that _ format but the field ID does not for it to work - the spry validation remains valid even after I change the ID back to '00' from '_0' in DW

The Spry Code for the same field is
<span id="_0NE0000000mXHj_Spry">
<input id="_0NE0000000mXHj" name="_0NE0000000mXHj" type="text" value="" class="formTextfield_Medium" tabindex="15" />
<span class="textfieldRequiredMsg">Please enter a value</span> </span>

But it still validates the field as required. I realize once i get the form as i want it, hand edit the ID's and leave it it will work but it makes me reticent to use Form Builder to modify small things on that form because even a color change triggers a compilation and reverts ALL of those 00 field Names to _0's

larry

Sign in to reply to this post

Jason ByrnesWebAssist

the reason this is happening is that Spry is a javascript framework.

ID's created for use by spry must conform to the javascript naming rules, and one of those rules is that the variable name cannot begin with a number.

In form builder, the element name is also used as the ID and in the Spry Span tags ID.


I will put though a feature request to add the ability to specify the ID for a form element as well as the name.

Sign in to reply to this post

drdocb

Thanks and Follow-up questions

Thank you - hopefully we can incorporate this change in the future since Salesforce seems here to stay.

Another How TO Question

Important How To. If the form action="<?php echo(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES));

So the e-mail can be generated, is there a simple way to then have a follow up action so I can use this ine so salesforce updates the lead from the form? need it to email the info then execute

<form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST">

Sign in to reply to this post

Jason ByrnesWebAssist

leave the action as is to send the email, then add the following code to the page after the UE code block to send the information to the www.salesforce.com server using cURL



php:
<?php

if (($_SERVER["REQUEST_METHOD"] == "POST"))     {
$c curl_init();
curl_setopt($cCURLOPT_URL"https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8");
curl_setopt($cCURLOPT_TIMEOUT90);
curl_setopt($cCURLOPT_POST1);
curl_setopt($cCURLOPT_SSL_VERIFYPEER0);
curl_setopt($cCURLOPT_RETURNTRANSFER1);
curl_setopt($cCURLOPT_POSTFIELDS$_POST);
$result curl_exec($c);
curl_close($c);

}
?>
Sign in to reply to this post

drdocb

Still Can't Seem To Make it Work

Jsaon:

Thank you for the code segment - I thought that might be the way to go but was looking at switching for action and resubmitting but this appears much cleaner.

I Added the segment both inside and outside the U(niversal) E(mail) UE block and still do not seem to have success though it seems to execute it does not send values.

I am posting the relevant page code (too many characters for the whole thing so attaching as a zip file). If you can show me where I should insert the curl code segment or give me an idea what is going wrong. If we need a private session, that is fine


<?php require_once("../../webassist/form_validations/wavt_scripts_php.php"); ?>
<?php require_once("../../webassist/form_validations/wavt_validatedform_php.php"); ?>
<?php
if (isset($_POST["input_1_submit_x"])) {
$WAFV_Redirect = "".(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)) ."?invalid=true";
$_SESSION['WAVT_email4_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ((isset($_POST["first_name"])?$_POST["first_name"]:"") . "",true,1);
$WAFV_Errors .= WAValidateRQ((isset($_POST["last_name"])?$_POST["last_name"]:"") . "",true,2);
$WAFV_Errors .= WAValidateEM((isset($_POST["email"])?$_POST["email"]:"") . "",true,3);
$WAFV_Errors .= WAValidateRQ((isset($_POST["street"])?$_POST["street"]:"") . "",true,4);
$WAFV_Errors .= WAValidateRQ((isset($_POST["city"])?$_POST["city"]:"") . "",true,5);
$WAFV_Errors .= WAValidateRQ((isset($_POST["state"])?$_POST["state"]:"") . "",true,6);
$WAFV_Errors .= WAValidateZC((isset($_POST["zip"])?$_POST["zip"]:"") . "",true,false,false,false,true,7);
$WAFV_Errors .= WAValidateRQ((isset($_POST["country"])?$_POST["country"]:"") . "",true,8);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000mXIq"])?$_POST["_0NE0000000mXIq"]:"") . "",true,9);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000mXHj"])?$_POST["_0NE0000000mXHj"]:"") . "",true,10);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000mXIw"])?$_POST["_0NE0000000mXIw"]:"") . "",true,11);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000mXJ0"])?$_POST["_0NE0000000mXJ0"]:"") . "",true,12);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000naon"])?$_POST["_0NE0000000naon"]:"") . "",true,13);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000mXJ"])?$_POST["_0NE0000000mXJ"]:"") . "",true,14);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000mXIl"])?$_POST["_0NE0000000mXIl"]:"") . "",true,15);
$WAFV_Errors .= WAValidateRQ((isset($_POST["_0NE0000000mXJe"])?$_POST["_0NE0000000mXJe"]:"") . "",true,16);
$WAFV_Errors .= WAValidateRX((isset($_POST["oid"])?$_POST["oid"]:"") . "","/.*/",false,17);
$WAFV_Errors .= WAValidateRX((isset($_POST["retURL"])?$_POST["retURL"]:"") . "","/.*/",false,18);

if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"email4");
}
}
?>
<?php require_once("../../webassist/email/mail_php.php"); ?>
<?php require_once("../../webassist/email/mailformatting_php.php"); ?>
<?php
if (!isset($_SESSION))session_start();
if ((isset($_POST["input_1_submit_x"]))) {
//WA Universal Email object="mail"
set_time_limit(0);
$EmailRef = "waue_email-3_1";
$BurstSize = 200;
$BurstTime = 1;
$WaitTime = 1;
$GoToPage = "";
$RecipArray = array();
$StartBurst = time();
$LoopCount = 0;
$TotalEmails = 0;
$RecipIndex = 0;
// build up recipients array
$CurIndex = sizeof($RecipArray);
$RecipArray[$CurIndex] = array();
$RecipArray[$CurIndex ][] = "office@naturalholistic.com";
$TotalEmails += sizeof($RecipArray[$CurIndex]);
$RealWait = ($WaitTime<0.25)?0.25:($WaitTime+0.1);
$TimeTracker = Array();
$TotalBursts = floor($TotalEmails/$BurstSize);
$AfterBursts = $TotalEmails % $BurstSize;
$TimeRemaining = ($TotalBursts * $BurstTime) + ($AfterBursts*$RealWait);
if ($TimeRemaining < ($TotalEmails*$RealWait) ) {
$TimeRemaining = $TotalEmails*$RealWait;
}
$_SESSION[$EmailRef."_Total"] = $TotalEmails;
$_SESSION[$EmailRef."_Index"] = 0;
$_SESSION[$EmailRef."_Remaining"] = $TimeRemaining;
while ($RecipIndex < sizeof($RecipArray)) {
$EnteredValue = is_string($RecipArray[$RecipIndex][0]);
$CurIndex = 0;
while (($EnteredValue && $CurIndex < sizeof($RecipArray[$RecipIndex])) || (!$EnteredValue && $RecipArray[$RecipIndex][0])) {
$starttime = microtime_float();
if ($EnteredValue) {
$RecipientEmail = $RecipArray[$RecipIndex][$CurIndex];
} else {
$RecipientEmail = $RecipArray[$RecipIndex][0][$RecipArray[$RecipIndex][2]];
}
$EmailsRemaining = ($TotalEmails- $LoopCount);
$BurstsRemaining = ceil(($EmailsRemaining-$AfterBursts)/$BurstSize);
$IntoBurst = ($EmailsRemaining-$AfterBursts) % $BurstSize;
if ($AfterBursts<$EmailsRemaining) $IntoBurst = 0;
$TimeRemaining = ($BurstsRemaining * $BurstTime * 60) + ((($AfterBursts<$EmailsRemaining)?$AfterBursts:$EmailsRemaining)*$RealWait) - (($AfterBursts>$EmailsRemaining)?0:($IntoBurst*$RealWait));
if ($TimeRemaining < ($EmailsRemaining*$RealWait) ) {
$TimeRemaining = $EmailsRemaining*$RealWait;
}
$CurIndex ++;
$LoopCount ++;
session_commit();
session_start();
$_SESSION[$EmailRef."_Index"] = $LoopCount;
$_SESSION[$EmailRef."_Remaining"] = round($TimeRemaining);
session_commit();
wa_sleep($WaitTime);
include("../../webassist/email/waue_email-3_1.php");
$endtime = microtime_float();
$TimeTracker[] =$endtime - $starttime;
$RealWait = array_sum($TimeTracker)/sizeof($TimeTracker);
if ($LoopCount % $BurstSize == 0 && $CurIndex < sizeof($RecipArray[$RecipIndex])) {
$TimePassed = (time() - $StartBurst);
if ($TimePassed < ($BurstTime*60)) {
$WaitBurst = ($BurstTime*60) -$TimePassed;
wa_sleep($WaitBurst);
}
else {
$TimeRemaining = ($TotalEmails- $LoopCount)*$RealWait;
}
$StartBurst = time();
}
if (!$EnteredValue) {
$RecipArray[$RecipIndex][0] = mysql_fetch_assoc($RecipArray[$RecipIndex][1]);
}
}
$RecipIndex ++;
}
$_SESSION[$EmailRef."_Total"] = 0;
$_SESSION[$EmailRef."_Index"] = 0;
$_SESSION[$EmailRef."_Remaining"] = 0;
session_commit();
session_start();
if (function_exists("rel2abs")) $GoToPage = $GoToPage?rel2abs($GoToPage,dirname(__FILE__)):"";
if ($GoToPage!="") {
header("Location: ".$GoToPage);
}


}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="../../webassist/progress_bar/jquery-blockui-formprocessing.js" type="text/javascript"></script>
<link href="../../SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<script src="../../SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="../../webassist/forms/wa_servervalidation.js" type="text/javascript"></script>
<link href="../../SpryAssets/SpryValidationTextarea.css" rel="stylesheet" type="text/css" />
<script src="../../SpryAssets/SpryValidationTextarea.js" type="text/javascript"></script>
<link href="../../SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<script src="../../SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<link href="../../webassist/forms/fd_newfromblank_default.css" rel="stylesheet" type="text/css" />
<link href="../../webassist/forms/fd_compact_default.css" rel="stylesheet" type="text/css" />
<link href="../../webassist/forms/fd_brassy_default.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form class="Brassy_Default" id="input_1_Brassy_Default" name="input_1_Brassy_Default" method="post" action="<?php echo(htmlentities($_SERVER["PHP_SELF"], ENT_QUOTES)); ?>">

Attached Files
email4.zip
Sign in to reply to this post

Jason ByrnesWebAssist

the cURL code should go just before the doctype tag:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...