Results 1 to 5 of 5

Thread: Web-to-lead form - how to populate fields with default data?

  1. #1
    marcuscherry is offline Sugar Community Member
    Join Date
    Aug 2007
    Posts
    44

    Default Web-to-lead form - how to populate fields with default data?

    Hi,

    I have created a web-to-lead form that works ok for my requirements but I want to exapnd the functionality if possible.

    I'm interested to know how I can populate specific fields with default values (that will be hidden from the user) when the form is submitted.

    Anyhelp appreciated. Unfortunately I have very limited php coding ability so the simpler solution the better.

    Thanks

    Marcus

  2. #2
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: Web-to-lead form - how to populate fields with default data?

    Where are these default values coming from? Are they calculated based on the values entered into the form? If that is the case, then you will need to write your logic in the web-to-lead form. Or if they are static values, then you can simply modify the html in the form and have default values passed in using the "hidden" HTML form tag.

    No matter what you are going to need to do some HTML or PHP coding.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  3. #3
    marcuscherry is offline Sugar Community Member
    Join Date
    Aug 2007
    Posts
    44

    Default Re: Web-to-lead form - how to populate fields with default data?

    A personal reply from one of the founders - i'm honoured!

    The values are normally selected from a drop down list in Sugar but each individual form will always use the same selection from the list so I guess these would be static values.

    When you say:
    you can simply modify the html in the form and have default values passed in using the "hidden" HTML form tag
    I take it you mean enter a line like something like this:
    Code:
    <td style="display: none;"><input type="hidden" value="1" name="assigned_user_id" id="assigned_user_id" /></td>
    Can you tell me where exactly the field name and and the value would go in this syntax? I'm guessing it would be after name= and then id=

    Thanks

    Marcus

    EDITED POST
    Have worked this out for myself - thanks for the help.
    Last edited by marcuscherry; 2008-02-13 at 04:28 PM. Reason: Solved issue

  4. #4
    clint's Avatar
    clint is offline Sugar Team Member | Forums Lead Moderator
    Join Date
    Aug 2004
    Location
    Silicon Valley
    Posts
    2,120

    Default Re: Web-to-lead form - how to populate fields with default data?

    Quote Originally Posted by marcuscherry
    A personal reply from one of the founders - i'm honoured!

    The values are normally selected from a drop down list in Sugar but each individual form will always use the same selection from the list so I guess these would be static values.

    When you say:


    I take it you mean enter a line like something like this:
    Code:
    <td style="display: none;"><input type="hidden" value="1" name="assigned_user_id" id="assigned_user_id" /></td>
    Can you tell me where exactly the field name and and the value would go in this syntax? I'm guessing it would be after name= and then id=
    That is the correct syntax. Note that if you are passing in the assigned_user_id field, it needs to be the id value (which is typically a string like "806511dg-928a-a14b-0b88-41478f811334"). You can find the id value for a particular user by going to Admin->User Management, searching for the user record that you want to assign the lead to and then exporting that record from the User List View. The exported CSV file will contain a column called id. That is the value you will want to pass in for the assigned_user_id field.
    Sugar Developer Zone - developer resources | Sugar University - user and admin training
    Sugar Docs - user and admin documentation |
    Sugar Bug Tracker - Enter or view bugs
    SugarForge- open source modules, themes, lang packs | SugarExchange - commercial extensions

    Clint Oram
    Chief Technology Officer and Co-founder
    SugarCRM

  5. #5
    marcuscherry is offline Sugar Community Member
    Join Date
    Aug 2007
    Posts
    44

    Default Re: Web-to-lead form - how to populate fields with default data?

    Great - thanks for the help. Got it working.

    Have thought of one more question though - is there any way I can make it throw out an error message if a lead with the submitted email address is already in the database?

    This is very important.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Add/Modify DB
    By russel2x2 in forum Developer Help
    Replies: 4
    Last Post: 2007-12-11, 10:19 AM
  2. Custom Fields not saving input data
    By mickster in forum Help
    Replies: 3
    Last Post: 2007-03-08, 01:50 PM
  3. Anyone had luck getting 'timesheet' to install
    By chucknb87122 in forum Downloads
    Replies: 7
    Last Post: 2006-03-07, 10:05 PM
  4. SugarCrm 4.0 Patch
    By mgamboa in forum General Discussion
    Replies: 0
    Last Post: 2005-12-21, 04:14 PM
  5. Convert Prospect to Lead
    By bryanl0911 in forum Feature Requests
    Replies: 23
    Last Post: 2005-10-09, 11:58 PM

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
  •