Results 1 to 4 of 4

Thread: Switch do_not_call value in WebToLeadCapture.php

  1. #1
    akbar is offline Member
    Join Date
    Jul 2004
    Posts
    7

    Default Switch do_not_call value in WebToLeadCapture.php

    Hi,

    I have a leadgen form that uses a checkbox and then "Yes, please have an account executive contact me". This is the exact inverse of the Do Not Call checkbox (which is the default used by SugarCRM).

    My question is, how do I switch the value of the checkbox to it's exact inverse.

    Namely, if the user checks "Yes, please have an account executive contact me", then I would want do_not_call set to unchecked in the DB, and vice versa.

    Thanks,
    Akbar

  2. #2
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Switch do_not_call value in WebToLeadCapture.php

    Setting do_not_call to 0 should work just the way you need it.

  3. #3
    akbar is offline Member
    Join Date
    Jul 2004
    Posts
    7

    Default Re: Switch do_not_call value in WebToLeadCapture.php

    Hi,

    I think I should elaborate a bit:


    I have an html form that posts to WebToLeadCapture.php.

    HTML Form
    ************
    1. In the form, I have a checkbox with id and name = contact_me
    2. contact_me has a text label = "Yes, I would like an account executive to contact me."
    3. contact_me is set to default = checked
    4. onClick of the Save button, I set do_not_call = contact me

    Note:
    do_not_call is checked when a person does not want to be called, but contact_me is unchecked when a person does not want to be called

    WebToLeadCapture.php
    **************************
    1. WebToLeadCapture.php saves do_not_call to the DB
    2. I would like to check for the value of do_not_call, and switch to the opposite value, such as:

    if (do_not_call == 1), then set do_not_call =0
    else if (do_not_call == 0), then set do_not_call =1

    Question
    *********
    How/where do I set the code to check the value of do_not_call and reverse it's value?

    Please note that I only want to change the value when the data is captured via a web form, not when a user is using the SugarCRM interface directly.

    Thanks,
    Akbar

  4. #4
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: Switch do_not_call value in WebToLeadCapture.php

    In WebToLeadCapture.php look for this code:
    PHP Code:
    foreach($_POST as $param => $value) {                 
        if(
    $param != 'redirect_url' ||$param != 'submit') {
            echo 
    '<input type="hidden" name="'.$param.'" value="'.$value.'">';

        }


    This is where it gets the fields passed to it and redirects it to process. You should be able to change the value here like:
    PHP Code:
    foreach($_POST as $param => $value) {                 
        if(
    $param != 'redirect_url' ||$param != 'submit') {
                   if(
    $param == 'do_not_call') {
                       
    $value = !$value//sets value to opposite (1 to 0 or 0 to 1)
                   

                    echo 
    '<input type="hidden" name="'.$param.'" value="'.$value.'">';          
        }


    Change as needed for the appropriate field.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 2
    Last Post: 2010-03-31, 12:28 PM
  2. Error on WebToLeadCapture.php page
    By daviddavid in forum Help
    Replies: 3
    Last Post: 2008-02-03, 02:10 PM
  3. webtoleadcapture.php spam?
    By gordo in forum Help
    Replies: 12
    Last Post: 2007-12-07, 05:44 PM
  4. Replies: 1
    Last Post: 2006-09-08, 06:19 PM
  5. XTPL -> Smarty switch?
    By gylany in forum Developer Help
    Replies: 4
    Last Post: 2006-05-30, 06:40 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
  •