problem embedding java form

Posted by Community Admin on 03-Aug-2018 23:24

problem embedding java form

All Replies

Posted by Community Admin on 22-Jan-2012 00:00
Hi,

I am trying to embed a java form into Sitefinty 4.4 that will post back to SugarCRM. I tried the java widget but think I am failing when it comes to stripping out the java tags. The form looks fine, the submit button depresses when I click it but the data does not post. Also, if I try to view the pages in the backend (after adding the form) the page ill not load.

The code that Sugar provides is .HTM and runs on my local computer and posts the form just fine.

thansk in advance for any guidance.

<form id="WebToLeadForm" action="http://trial.sugarcrm.com/thaibm7501/index.php?entryPoint=WebToLeadCapture" method="POST" name="WebToLeadForm">
<table style="background-position: top; padding: 10px 6px 12px 10px; width: 100%; font-size: 12px; border-top-color: currentColor; border-bottom-color: currentColor; border-top-width: 1px; border-bottom-width: 1px; border-top-style: solid; border-bottom-style: solid; background-repeat: repeat-x; background-color: #e9f3ff;">
<tbody>
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" align="center">
<td colspan="4">
<h2>Web to lead form for Campaign</h2>
</td>
</tr>
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 2px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="center">
<td colspan="4"> </td>
</tr>
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 12px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="left">
<td colspan="4">Submitting this form will create a lead and link with campaign</td>
</tr>
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 8px; font-weight: normal; margin-bottom: 0px; margin-top: 0px;" align="center">
<td colspan="4"> </td>
</tr>
<tr>
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>First Name: </span></td>
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="first_name" type="text" name="first_name" /></span></td>
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span> </span></td>
<td style="font-size: 12px; font-weight: normal;" width="35%"><span> </span></td>
</tr>
<tr>
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Last Name: <span class="required" style="color: #ff0000;">*</span></span></td>
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="last_name" type="text" name="last_name" /></span></td>
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span> </span></td>
<td style="font-size: 12px; font-weight: normal;" width="35%"><span> </span></td>
</tr>
<tr>
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span>Email Address: </span></td>
<td style="font-size: 12px; font-weight: normal;" width="35%"><span><input id="webtolead_email1" type="text" name="webtolead_email1" onchange="validateEmailAdd();" /></span></td>
<td style="text-align: left; font-size: 12px; font-weight: normal;" width="15%"><span> </span></td>
<td style="font-size: 12px; font-weight: normal;" width="35%"><span> </span></td>
</tr>
<tr style="color: #0069e1; font-family: Arial,Verdana,Helvetica,sans-serif; font-size: 18px; font-weight: bold; margin-bottom: 0px; margin-top: 0px;" align="center">
<td colspan="4"> </td>
</tr>
<tr align="center">
<td colspan="10"><input class="button" onclick="submit_form();" type="button" name="Submit" value="Submit" /></td>
</tr>
<tr>
<td style="display: none;"><input id="campaign_id" type="hidden" name="campaign_id" value="d176806c-c16d-e80b-8151-4cd03ef91a6e" /></td>
</tr>
<tr>
<td style="display: none;"><input id="redirect_url" type="hidden" name="redirect_url" value="http://acmepos.com" /></td>
</tr>
<tr>
<td style="display: none;"><input id="assigned_user_id" type="hidden" name="assigned_user_id" value="seed_will_id" /></td>
</tr>
<tr>
<td style="display: none;"><input id="team_id" type="hidden" name="team_id" value="East" /></td>
</tr>
<tr>
<td style="display: none;"><input id="team_set_id" type="hidden" name="team_set_id" value="East" /></td>
</tr>
<tr>
<td style="display: none;"><input id="req_id" type="hidden" name="req_id" value="last_name;" /></td>
</tr>
</tbody>
</table>
</form>
<script type="text/javascript">// <![CDATA[
 function submit_form()
    if(typeof(validateCaptchaAndSubmit)!='undefined')
        validateCaptchaAndSubmit();
    else
        check_webtolead_fields();
    
 
 function check_webtolead_fields()
     if(document.getElementById('bool_id') != null)
        var reqs=document.getElementById('bool_id').value;
        bools = reqs.substring(0,reqs.lastIndexOf(';'));
        var bool_fields = new Array();
        var bool_fields = bools.split(';');
        nbr_fields = bool_fields.length;
        for(var i=0;i<nbr_fields;i++)
          if(document.getElementById(bool_fields[i]).value == 'on')
             document.getElementById(bool_fields[i]).value = 1;
          
          else
             document.getElementById(bool_fields[i]).value = 0;
          
        
      
    if(document.getElementById('req_id') != null)
        var reqs=document.getElementById('req_id').value;
        reqs = reqs.substring(0,reqs.lastIndexOf(';'));
        var req_fields = new Array();
        var req_fields = reqs.split(';');
        nbr_fields = req_fields.length;
        var req = true;
        for(var i=0;i<nbr_fields;i++)
          if(document.getElementById(req_fields[i]).value.length <=0 || document.getElementById(req_fields[i]).value==0)
           req = false;
           break;
          
        
        if(req)
            document.WebToLeadForm.submit();
            return true;
        
        else
          alert('Please provide all the required fields');
          return false;
         
        return false
   
   else
    document.WebToLeadForm.submit();
   
function validateEmailAdd()
    if(document.getElementById('webtolead_email1').value.length >0)
        if(document.getElementById('webtolead_email1').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w2,)+$/) == null)
          alert('Not a valid email address');
        
    
    if(document.getElementById('webtolead_email2').value.length >0)
        if(document.getElementById('webtolead_email2').value.match(/^\w+(['\.\-\+]?\w+)*@\w+([\.-]?\w+)*(\.\w2,)+$/) == null)
          alert('Not a valid email address');
        
    
// ]]></script></body></html>
Posted by Community Admin on 25-Jan-2012 00:00
Hi Bob,

You can put the code on a master page and then create a template in Sitefinity that will be based on that masterpage - this way there should be no problems using it as on any other standard ASP.NET page. Please let us know if any problems persist or the desired scenario differs from what I've proposed. 

Greetings,
Boyan Barnev
the Telerik team
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
 
Posted by Community Admin on 26-Jan-2012 00:00
Hi,
Thank you for the respnse.

I cannot determine how to "put the code on a master page".  Can you please provide an example using above HTML or point me towards a more complete answer?

Bob
Posted by Community Admin on 31-Jan-2012 00:00
Hi Bob,

I apologize if you found the previous response incomplete, please find attached a sample MasterPage and a short video demonstrating it setup in Sitefinity and the form present and functional on a Sitefinity page. Please do not hesitate to get back to me if you need some additional assistance, it was a pleasure for me to help you.

Greetings,
Boyan Barnev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
This thread is closed