Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 15th, 2006, 03:57 AM
Registered User
 
Join Date: Feb 2006
Location: Chennai, TamilNadu, India.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to changusee2k
Default Problem with editing my cell data in PHP.

Hi all,
I have to design a page which looks like a table (Excel Sheet) in PHP., i.e. in the column part it has all the headers like PLExplanation, Date, BookName1, BookName2, BookName3, BookName4 etc. listed and in the row part it is having the row number. now the intersecting cell will contain the data. Upon Clicking that cell, user will be presented with a Menuwindow in which he can select the options Edit or Audit. In the menuwindow when you select edit option, the cell becomes editable and the user can change the value. But the cell is not becoming editable when the edit option is selected. I'm showing the code below for your reference. Please help me in this regard as it is very urgent for me.
Code:
<Script>

function displayMenu(thisobj) {
    document.all.txthidden.value=thisobj.name;
    contextMenu.style.leftPos+=10;
    contextMenu.style.posLeft=event.clientX;
    contextMenu.style.posTop=event.clientY;
    contextMenu.style.display="";
    contextMenu.setCapture();
}

function clickMenu() {
    contextMenu.releaseCapture();
    contextMenu.style.display="none";
    el=event.srcElement;
    document.all.mnuhidden.value=el.id;
    if (el.id=="menuRiskEngine") {
        doRiskEngine();
    }
    else if (el.id=="menuEdit") {
        doEdit();
    }
    else if (el.id=="Audit") {
        doAudit();
    }
}

function doRiskEngine() {
    alert('doRiskEngine');
}

function doEdit() {
    var objstr='document.PLReportForm.'+document.PLReportForm.txthidden.value;
    var obj=eval(objstr);
    alert('value='+obj.value);
    if (obj.readOnly == true){
        obj.readOnly=false;
        obj.className=obj.className+"b";
    }
    obj.focus();    
        obj.select();
}

function doAudit() {
    alert('doAudit');
}

function switchMenu() {
    el=event.srcElement;
    if (el.className=="menuItem") {
        el.className="highlightItem";
    }
    else if (el.className=="highlightItem") {
        el.className="menuItem";
    }
}

function changeType(thiscobj) {
    if ((document.all.mnuhidden.value == "menuEdit") && (thiscobj.readOnly == false)){
        //alert('menu = '+document.all.mnuhidden.value);
        thiscobj.readOnly=true;
        //alert(thiscobj.className+'-'+thiscobj.className+'-'+thiscobj.value);
        thiscobj.className=thiscobj.className.substr(0,thiscobj.className.length-1);
    }
}

function saveData(){
    alert("Testing....");
}
</Script>

<html>
    <head>
        <title>CFXRisk P&L Reporting - Error</title>
        <meta content="Evrsoft First Page" name="GENERATOR">
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Expires" content="-1">

        <style>
            body {
                padding-right: 0px;
                padding-left: 0px;
                padding-bottom: 0px;
                margin: 0px;
                overflow: hidden;
                padding-top: 0px; }
            html {
                padding-right: 0px;
                padding-left: 0px;
                padding-bottom: 0px;
                margin: 0px;
                overflow: hidden;
                padding-top: 0px; }
            .menuItem {
                font-family:ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                width:100%;
                padding-left:16;
                background-Color:menu;
                color:black;
                padding-top: 2px;
                padding-bottom: 2px;
                margin-bottom:0;
                margin-top:0;
                cursor: default; }
            .menuItemDefault {
                font-family:ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                font-weight:bold;
                width:100%;
                padding-left:16;
                background-Color:menu;
                color:black;
                padding-top: 2px;
                padding-bottom: 2px;
                cursor: default; }
            .highlightItem {
                font-family:ms sans serif,helvetica,arial, sans-serif;
                font-size:8pt;
                width:100%;
                padding-left:16;
                background-Color:highlight;
                color:white;
                padding-top: 2px;
                padding-bottom: 2px;
                cursor: default; }
            .textgry {
                font-family:verdana,ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                background-Color:gray;
                cursor: default;
                width:280;
                text-align:left;
                border:none;}
            .textgrn {
                font-family:verdana,ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                background-Color:lightgreen;
                cursor: default;
                width:117;
                text-align:right;
                border:none;}
            .textwht {
                font-family:verdana,ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                background-Color:white;
                cursor: default;
                width:117;
                text-align:right;
                border:none;}
            .texttit {
                font-family:arial,verdana,ms sans serif,helvetica,sans-serif;
                font-size:9pt;
                color:#10659e;
                background-Color:#dbeaf5;
                cursor:default;
                text-align:center;}
            .textgryb {
                font-family:verdana,ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                background-Color:gray;
                cursor: wait;
                width:280;
                text-align:left;}
            .textgrnb {
                font-family:verdana,ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                background-Color:lightgreen;
                cursor: wait;
                width:117;
                text-align:right;}
            .textwhtb {
                font-family:verdana,ms sans serif,helvetica,arial,sans-serif;
                font-size:8pt;
                background-Color:white;
                cursor: wait;
                width:117;
                text-align:right;}
        </style>
    </head>

    <body>

        <?php
            include("header.htm");
            include("functions.php");
            session_start();
            header("Cache-control: private");
            $dbh = db_connect();

            $result = mysql_query("SELECT * FROM plsample", $dbh); 
            if (!$result) { 
              echo("<p>Error performing query: " . mysql_error() . "</p>"); 
              exit(); 
            } 
        ?>
        <form name=PLReportForm method=POST>
            <div id=contextMenu onclick="clickMenu()"
                onmouseover="switchMenu()"
                onmouseout="switchMenu()"
                style="position:absolute;  display:none; width:130;  background-Color:menu;  border: 2px outset; ">
                    <div class="menuItem" id=menuRiskEngine>Risk Engine</div>

                    <div class="menuItem" id=menuEdit>Edit</div>

                    <div class="menuItem" id=Audit>Audit</div>
            </div>
            <h1 id="header"><a href="http://www.worldnet.ml.com"><img height="44" alt="Logo" src="images/gblmkts_logo.gif" width="117" align="absmiddle" vspace="-5" border="0"></a> CFXRisk - P&L   Reporting</h1>
            <table border="1" cellspacing="0" cellpadding="0" align:left style="border: 1 solid hidden">

                <tr>
                <td class=texttit> </td>
                <td class=texttit> P/L Explaination</td>
                <td class=texttit> 22 Feb</td>
                <td class=texttit> OPEV </td>
                <td class=texttit> OPSD </td>
                <td class=texttit> OPSE </td>
                <td class=texttit> OPAL </td>
                <td class=texttit> OPPR </td>
                </tr>
                <?php
                    while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) 
                    {
                        $r=1;
                        $c=1;
                        echo "<tr><td class=texttit>" . $row['SlNo'] . "</td>";
                        echo "<td><input name=t$r$c type=text class=textgry onblur=changeType(this) oncontextmenu=displayMenu(this) return false onclick=displayMenu(this) return false readonly ovalue=\"" . $row['PLExplanation'] . "\" value=\"" . $row['PLExplanation'] . "\"></td>";
                        $c++;
                        echo "<td><input name=t$r$c type=text class=textgrn onblur=changeType(this) oncontextmenu=displayMenu(this) return false onclick=displayMenu(this) return false readonly ovalue=\"" . $row['COBDate'] . "\"value=" . $row['COBDate'] . "></td>";
                        $c++;
                        echo "<td><input name=t$r$c type=text class=textwht onblur=changeType(this) oncontextmenu=displayMenu(this) return false onclick=displayMenu(this) return false readonly ovalue=\"" . $row['OPEV'] . "\"value=" . $row['OPEV'] . "></td>";
                        $c++;
                        echo "<td><input name=t$r$c type=text class=textwht onblur=changeType(this) oncontextmenu=displayMenu(this) return false onclick=displayMenu(this) return false readonly ovalue=\"" . $row['OPSD'] . "\"value=" . $row['OPSD'] . "></td>"; 
                        $c++;
                        echo "<td><input name=t$r$c type=text class=textwht onblur=changeType(this) oncontextmenu=displayMenu(this) return false onclick=displayMenu(this) return false readonly ovalue=\"" . $row['OPSE'] . "\"value=" . $row['OPSE'] . "></td>"; 
                        $c++;
                        echo "<td><input name=t$r$c type=text class=textwht onblur=changeType(this) oncontextmenu=displayMenu(this) return false onclick=displayMenu(this) return false readonly ovalue=\"" . $row['OPAL'] . "\"value=" . $row['OPAL'] . "></td>"; 
                        $c++;
                        echo "<td><input name=t$r$c type=text class=textwht onblur=changeType(this) oncontextmenu=displayMenu(this) return false onclick=displayMenu(this) return false readonly ovalue=\"" . $row['OPPR'] . "\"value=" . $row['OPPR'] . "></td>";
                        echo "</tr>"; 
                        $r++;
                    } 
                ?>
            </table>

            <input name="txthidden" type=hidden>
            <input name="mnuhidden" type=hidden>

            <table>
                <tr></tr><tr></tr>
                <tr><td align=center><input type="submit" value="Save" name="Submit1" class="button" onclick=saveData()></td>
                <td align=center><input id="Reset1" type="reset" value="Cancel" name="Reset1" class="button"     onclick=refresh(document.PLReportForm,"reset")></td></tr>
            </table>

        </form>
    </body>
</html>
As you can see in the above code, the line of Code in red displays "value=undefined" and the line in green is shows an error saying "Object doesn't support this property or method". Please give me your valuable suggestion as to how this can be resolved.

chandru
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy data into cell by cell zone Excel VBA 2 September 4th, 2007 11:50 AM
editing datagrid and changing cell color upon edit matoaka VS.NET 2002/2003 0 August 11th, 2006 11:04 AM
Lose cell Text when editing cell in VSFlexGrid 6 bobcratchet VB How-To 0 July 30th, 2004 09:32 AM
cell editing saiyedriyaz BOOK: Beginning Java 2 1 May 15th, 2004 04:27 AM
Editing MySQL data from a PHP form cmiller Beginning PHP 2 September 2nd, 2003 05:11 PM



All times are GMT -4. The time now is 07:15 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.