Results 1 to 3 of 3

Thread: Web Form Capture-- Sugar Professional

  1. #1
    msradha is offline Junior Member
    Join Date
    Sep 2006
    Posts
    3

    Question Web Form Capture-- Sugar Professional

    I have this code that's supposed to help set up a web form to capture leads. Sugar isn't hosted on my server, though... and I'm not sure which parts of this code should be replaced with my information. I'm also not sure if any new pages need to be created for this to work. (Example, it references "FormValidationTest.php'... is that already wherever my Sugar instance is hosted?

    Any help would be muchly appreciated.


    Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    /*********************************************************************************
     * The contents of this file are subject to the SugarCRM Professional End User
     * License Agreement ("License") which can be viewed at
     * http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
     * By installing or using this file, You have unconditionally agreed to the
     * terms and conditions of the License, and You may not use this file except in
     * compliance with the License.  Under the terms of the license, You shall not,
     * among other things: 1) sublicense, resell, rent, lease, redistribute, assign
     * or otherwise transfer Your rights to the Software, and 2) use the Software
     * for timesharing or service bureau purposes such as hosting the Software for
     * commercial gain and/or for the benefit of a third party.  Use of the Software
     * may be subject to applicable fees and any use of the Software without first
     * paying applicable fees is strictly prohibited.  You do not have the right to
     * remove SugarCRM copyrights from the source code or user interface.
     *
     * All copies of the Covered Code must include on each user interface screen:
     *  (i) the "Powered by SugarCRM" logo and
     *  (ii) the SugarCRM copyright notice
     * in the same form as they appear in the distribution.  See full license for
     * requirements.
     *
     * Your Warranty, Limitations of liability and Indemnity are expressly stated
     * in the License.  Please refer to the License for the specific language
     * governing these rights and limitations under the License.  Portions created
     * by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; All Rights Reserved.
     ********************************************************************************/
    ?>
    <script>
    	function addToDescription(form, name, value){
    			form.description.value += '--' + name + "=" + value+ "--"
    	}
    </script>
    <form name='leadcap' action='../leadCapture.php' method='post'>
    	<input type='hidden' name='lead_source' value='Web Site'>
    	<input type='hidden' name='user' value='cheeto'>
    	<input type='hidden' name='description' value=''>
    	<input type='hidden' name='redirect' value='http://localhost/sugarcrm/examples/FormValidationTest.php'>
    	<div align='center'>
    	Please fill out this form so we can better server your game playing and food eating needs. It will redirect you to the form validation test.
    	<table border=1><tr><td><table>
    	<tr><td>First Name:</td><td><input type='text' name='first_name'></td></tr>
    	<tr><td>Last Name:</td><td><input type='text' name='last_name'></td></tr>
    	<tr><td>Company Name:</td><td><input type='text' name='account_name'></td></tr>
    	<tr><td>Title:</td><td><input type='text' name='title'></td></tr> 
    	<tr><td>Favorite Game:</td><td><select name='game'>
    		<option value='monopoly'> Monopoly</option>
    		<option value='uno'> UNO</option>
    		<option value='sorry'> Sorry</option>
    		<option value='Checkers'> Checkers</option>
    	</select></td></tr>
    	<tr><td>Favorite Food:</td><td><select name='food'>
    		<option value='pizza'> Pizza</option>
    		<option value='hamburger'> Hamburger</option>
    		<option value='candy'> Candy </option>
    		<option value='icecream'> Ice Cream</option>
    	</select></td></tr>
    	
    	<tr><td></td><td><input type='Submit' name='submit' value='Submit' onclick='addToDescription(document.leadcap,"Favorite Food", document.leadcap.food.options[document.leadcap.food.selectedIndex].text);addToDescription(document.leadcap,"Favorite Game", document.leadcap.game.options[document.leadcap.game.selectedIndex].text);' ></td></tr></table></table>
    </form>

  2. #2
    sacramentojoe is offline Sugar Community Member
    Join Date
    Nov 2005
    Posts
    447

    Default Re: Web Form Capture-- Sugar Professional

    Quote Originally Posted by msradha
    I have this code that's supposed to help set up a web form to capture leads. Sugar isn't hosted on my server, though... and I'm not sure which parts of this code should be replaced with my information. I'm also not sure if any new pages need to be created for this to work. (Example, it references "FormValidationTest.php'... is that already wherever my Sugar instance is hosted?

    Any help would be muchly appreciated.


    Code:
    <?php
    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
    /*********************************************************************************
     * The contents of this file are subject to the SugarCRM Professional End User
     * License Agreement ("License") which can be viewed at
     * http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
     * By installing or using this file, You have unconditionally agreed to the
     * terms and conditions of the License, and You may not use this file except in
     * compliance with the License.  Under the terms of the license, You shall not,
     * among other things: 1) sublicense, resell, rent, lease, redistribute, assign
     * or otherwise transfer Your rights to the Software, and 2) use the Software
     * for timesharing or service bureau purposes such as hosting the Software for
     * commercial gain and/or for the benefit of a third party.  Use of the Software
     * may be subject to applicable fees and any use of the Software without first
     * paying applicable fees is strictly prohibited.  You do not have the right to
     * remove SugarCRM copyrights from the source code or user interface.
     *
     * All copies of the Covered Code must include on each user interface screen:
     *  (i) the "Powered by SugarCRM" logo and
     *  (ii) the SugarCRM copyright notice
     * in the same form as they appear in the distribution.  See full license for
     * requirements.
     *
     * Your Warranty, Limitations of liability and Indemnity are expressly stated
     * in the License.  Please refer to the License for the specific language
     * governing these rights and limitations under the License.  Portions created
     * by SugarCRM are Copyright (C) 2004-2006 SugarCRM, Inc.; All Rights Reserved.
     ********************************************************************************/
    ?>
    <script>
    	function addToDescription(form, name, value){
    			form.description.value += '--' + name + "=" + value+ "--"
    	}
    </script>
    <form name='leadcap' action='../leadCapture.php' method='post'>
    	<input type='hidden' name='lead_source' value='Web Site'>
    	<input type='hidden' name='user' value='cheeto'>
    	<input type='hidden' name='description' value=''>
    	<input type='hidden' name='redirect' value='http://localhost/sugarcrm/examples/FormValidationTest.php'>
    	<div align='center'>
    	Please fill out this form so we can better server your game playing and food eating needs. It will redirect you to the form validation test.
    	<table border=1><tr><td><table>
    	<tr><td>First Name:</td><td><input type='text' name='first_name'></td></tr>
    	<tr><td>Last Name:</td><td><input type='text' name='last_name'></td></tr>
    	<tr><td>Company Name:</td><td><input type='text' name='account_name'></td></tr>
    	<tr><td>Title:</td><td><input type='text' name='title'></td></tr> 
    	<tr><td>Favorite Game:</td><td><select name='game'>
    		<option value='monopoly'> Monopoly</option>
    		<option value='uno'> UNO</option>
    		<option value='sorry'> Sorry</option>
    		<option value='Checkers'> Checkers</option>
    	</select></td></tr>
    	<tr><td>Favorite Food:</td><td><select name='food'>
    		<option value='pizza'> Pizza</option>
    		<option value='hamburger'> Hamburger</option>
    		<option value='candy'> Candy </option>
    		<option value='icecream'> Ice Cream</option>
    	</select></td></tr>
    	
    	<tr><td></td><td><input type='Submit' name='submit' value='Submit' onclick='addToDescription(document.leadcap,"Favorite Food", document.leadcap.food.options[document.leadcap.food.selectedIndex].text);addToDescription(document.leadcap,"Favorite Game", document.leadcap.game.options[document.leadcap.game.selectedIndex].text);' ></td></tr></table></table>
    </form>

    Hi there, there are two files you'll need.
    One is the leadCapture.php which is located on the docroot level of your sugar install.
    There is a line that needs to be configured.
    It says random key then username and password (which is actually the hash) as the pass.
    The unique key needs to be the user that you're using to authenticate.
    You then have to put in the user again and their hash.

    The second page is your form that you'll be capturing the data from.

    You need to keep the <input type-hidden' name='user' value=''>
    If you want a page to be re-directed, you'll need the redirect_url as well.
    You just have your form post to http://sugarinstall/loeadCapture.php

    You also need to name your form fields the same as teh fields in the database for leads.

    Hope this helps.

  3. #3
    msradha is offline Junior Member
    Join Date
    Sep 2006
    Posts
    3

    Default Re: Web Form Capture-- Sugar Professional

    thank you!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •