Search code examples
business-catalyst

Business Catalyst Web Form Error


I have started using Adobe Business Catalyst and I am adjusting an existing HTML web form with the web form generated by BC. Even though I added a FirstName and LastName text field after reading this at the Adobe Community Forums stating this is mandatory for the Adobe CRM I still keep on getting errors: ERROR: An error occurred. Your web form must capture customer name and email address. Please fix this issue and re-insert your web form on your web page. Here is the current form:

<form name="catwebformform81533" method="post" onsubmit="return checkWholeForm81533(this)" 
            enctype="multipart/form-data" action="http://domain.businesscatalyst.com/FormProcessv2.aspx?WebFormID=74594&OID={module_oid}&OTYPE={module_otype}&EID={module_eid}&CID={module_cid}" id="form">
            <div class="span4">
<input type="text" name="FirstName" id="FirstName" class="cat_textbox" maxlength="255" value="ingevuld"/> 
<input type="text" name="LastName" id="LastName" class="cat_textbox" maxlength="255" value="ingevuld" />
                <div class="field">
                    <label>Name:</label>
                    <input type="text" name="name" value="" id="name"/>
                </div>
                <div class="field">
                    <label>Email:</label>
                    <input type="text" name="email" value="" id="email" />
                </div>
                <div class="field">
                    <label>Subject:</label>
                    <input type="text" name="subject" value="" name="CAT_Custom_343661" id="CAT_Custom_343661" />
                </div>
            </div>

            <div class="span4">
                <div class="field">
                    <label>Message:</label>
                    <textarea rows="7" name="CAT_Custom_343660" id="CAT_Custom_343660" 
                    onkeydown="if(this.value.length>=4000)this.value=this.value.substring(0,3999);"></textarea>
                </div>
                <div class="field">
                {module_recaptcha}
                </div>
                <div class="submitbutton clearfix">
                    <input type="submit" value="Send Your Message" class="m-btn red rnd right"/>
                </div>
            </div>
                <script type="text/javascript" src="http://domain.businesscatalyst.com/CatalystScripts/ValidationFunctions.js">
                </script><script type="text/javascript">
//<![CDATA[
var submitcount81533 = 0;function checkWholeForm81533(theForm){var why = "";
if (theForm.email) why += checkEmail(theForm.email.value);
if (theForm.CAT_Custom_343661) why += isEmpty(theForm.CAT_Custom_343661.value, "Subject");
if (theForm.CAT_Custom_343660) why += isEmpty(theForm.CAT_Custom_343660.value, "Message");
if(why != ""){alert(why);return false;}if(submitcount81533 == 0){submitcount81533++;
theForm.submit();return false;}else{alert("Form submission is in progress.");return false;}}
//]]>
</script>
            </form>

I have added values for the FirstName and LastName field and hid them with CSS just to appease Adobe mandatory fields. No joy yet though. Any ideas what I should adjust?


Solution

  • Seems like I had to change the id for the email address and the name for that field:

    <input type="text" name="EmailAddress" value="" id="EmailAddress"  />
    

    Together with this validation

    script type="text/javascript" src="http://domain.businesscatalyst.com/CatalystScripts/ValidationFunctions.js"></script>
                    <script type="text/javascript">
    //<![CDATA[
    var submitcount16251 = 0;function checkWholeForm16251(theForm){var why = "";
    if (theForm.EmailAddress) why += checkEmail(theForm.EmailAddress.value); 
    if (theForm.FirstName) why += isEmpty(theForm.FirstName.value, "First Name");
    if (theForm.LastName) why += isEmpty(theForm.LastName.value, "Last Name"); 
    if(why != ""){alert(why);return false;}if(submitcount16251 == 0){submitcount16251++;
    theForm.submit();
    return false;}else{alert("Form submission is in progress.");return false;}}
    //]]>
    </script>
    

    FullName

    You can also combine the first name with the last name so you do not need two separate fields, which I hardly ever use for clients. See link here. Input field would be

    <input type="text" name="FullName" id="FullName" class="cat_textbox" maxlength="255" />
    

    IDs

    I also adjusted the different tag ID numbers as I was using ids from two generated forms. This was not really necessary as one form for which you ask the HTML to add will assign new ids to all several tags every time you do this. But the validation changes and email tag changes did help.This made sure the loaded the thank you on the same page. Also make sure the WebFormID is related to an existing created Webform in the backend!

    System Confirmation Page

    Only I got several 404s for loaded stylesheets and javascripts and a page loaded without styling. this was because the system confirmation page was trying to load some non existing stylesheet. Was not too hard to fix in the end by creating a new template.