Results 1 to 4 of 4

Thread: My Lead Contact Addon

  1. #1
    Join Date
    Feb 2007
    Posts
    312

    Default My Lead Contact Addon

    I have been working on my lead contact addon and wanted to show the function:

    My problem is that the div tag does not hide any of the tables, it automatically opens them, and does not close....

    just thought i would post this in case anyone had a suggestion. thanks

    function leadstabletest_display_addon() {
    $security_admin = login::loginCheck('Admin', true);
    $security_agent = login::loginCheck('Agent', true);
    if ($security_admin === true || $security_agent === true) {
    global $config, $conn, $jscript;
    require_once($config['basepath'] . '/include/misc.inc.php');
    $misc = new misc();

    // SELECT A COLUMN NAME FROM A TABLE:
    $sql = 'SELECT * from registration_table WHERE nhm_associate="Not Specified"';
    // EXECUTE
    $recordSet = $conn->Execute($sql);
    // CHECK IF ERROR
    if ($recordSet === false) {
    $misc->log_error($sql);
    }
    // KEEP READING TILL THE END
    while (!$recordSet->EOF) {
    // ASSOCIATE THE FIELD VALUE WITH A VARIABLE
    $reg_id = $misc->make_db_unsafe ($recordSet->fields['rec_id']);
    $reg_leaddate = $misc->make_db_unsafe ($recordSet->fields['lead_date']);
    $reg_assoc = $misc->make_db_unsafe ($recordSet->fields['nhm_associate']);
    $reg_fname = $misc->make_db_unsafe ($recordSet->fields['fname']);
    $reg_lname = $misc->make_db_unsafe ($recordSet->fields['lname']);
    $reg_home_phone = $misc->make_db_unsafe ($recordSet->fields['home_phone']);
    $reg_cell_phone = $misc->make_db_unsafe ($recordSet->fields['cell_phone']);
    $reg_email = $misc->make_db_unsafe ($recordSet->fields['email']);
    $reg_remarks = $misc->make_db_unsafe ($recordSet->fields['remarks']);
    // PREPARE TO PRINT
    $display .= '<script language="javascript">
    function toggleDiv(divid){
    if(document.getElementById(divid).style.display == \'none\'){
    document.getElementById(divid).style.display = \'block\';
    }else{
    document.getElementById(divid).style.display = \'none\';
    }
    }
    </script>
    <table width="500" border="1" style="border-collapse:collapse" bordercolor="#000000">
    <a href="javascript:;" onclick="toggleDiv(\'' . $reg_id . '\');">' . $reg_fname . '&nbsp;' . $reg_lname .'</a> <br />
    <div id="' . $reg_id . '" style="display: none;">
    <tr>
    <td width="160">Lead Capture Date:</td>
    <td width="375">' . $reg_leaddate . '</td>
    </tr>
    <tr>
    <td>Name(s):</td>
    <td>' . $reg_fname . '&nbsp;' . $reg_lname .'</td>
    </tr>
    <tr>
    <td>Home Phone: </td>
    <td>' . $reg_home_phone . '</td>
    </tr>
    <tr>
    <td>Mobile Phone: </td>
    <td>' . $reg_cell_phone . '</td>
    </tr>
    <tr>
    <td>E-Mail:</td>
    <td>' . $reg_email . '</td>
    </tr>
    <tr>
    <td>Last Visit Date: </td>
    <td>&nbsp;</td>
    </tr>
    <tr>
    <td>Personal Remarks: </td>
    <td>' . $reg_remarks .'</td>
    </tr>
    </div></table>';
    // GO GET THE NEXT ONE
    $recordSet->MoveNext();
    }


    } else {
    // DISPLAY A WARNING TO THE PAGE AS ADMIN/AGENT IS NOT LOGGED
    $display .= 'YOU ARE NOT AUTHORIZED TO VIEW THIS PAGE. PLEASE GO TO THE BOTTOM OF THE PAGE AND LOG IN!';
    $recordSet->MoveNext();
    }
    return $display;
    }

  2. #2
    Join Date
    Mar 2004
    Age
    99
    Posts
    207

    Default Re: My Lead Contact Addon

    Silly question, but you have $reg_id pulling 'rec_id' from your db - is the db field name correct?

  3. #3
    Join Date
    Jul 2003
    Location
    California
    Age
    43
    Posts
    4,229

    Default Re: My Lead Contact Addon

    Code:
    <table width="500" border="1" style="border-collapse:collapse" bordercolor="#000000">
    <a href="javascript:;" onclick="toggleDiv(\'' . $reg_id . '\');">' . $reg_fname . '&nbsp;' . $reg_lname .'</a> <br />
    <div id="' . $reg_id . '" style="display: none;">
    <tr>
    <td width="160">Lead Capture Date:</td>
    You have your div starting between the <table> and <tr> tags, this is not proper nesting and is not compliant code.

    You can have a div within a table cell, or have the table within a div but you can't have a div within just the table but before the table row and cell.

    This may or may not be your problem but it certainly is a good place to start
    Open-Realty 2 Documentation

    ~The Difference Between an ORDEAL and an ADVENTURE is ATTITUDE~

  4. #4
    Join Date
    Feb 2007
    Posts
    312

    Default Re: My Lead Contact Addon

    that was the problem Mick...

    i found that while i looked a little harder at the code.

    thanks

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
  •