views:

45

answers:

2

I am using following code to display HTML Form on my web page. This code also uses a third-party .js file that is linked to it. Everything is working fine except that when the first record is inserted and after saving the record the control comes back to this form, the company name entered in the first entry is seen in the code itself. I mean to say that the entry company name is somehow gets inserted into the HTML code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
<html>
    <head>
     <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
     <script type="text/javascript" src="widgEditor.js"></script>
     <title>Job Listing Entry</title>
    </head>
    <body>
     <Form id="frmNewEntry" method="post" action="insert_listing.php">
      <table id="tblEntry" cols="2" border="0">
       <tr><td>Date:</td><td><input id="LDate" name="LDate" type="text" size="50">[yyyy/mm/dd]</td></tr>
       <tr><td>Places:</td><td><input id="Places" name="Places" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"></td></tr>
       <tr><td>Company:</td><td><input id="Company" name="Company" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"></td></tr>
       <tr><td>Designation:</td><td><input id="Designation" name="Designation" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"></td></tr>
       <tr><td>Project Details:</td><td><textarea class="widgEditor" id="ProjectDetails" name="ProjectDetails" cols="100" rows="10""></textarea> <br></td></tr>
       <tr><td>Desired Candidate:</td><td><textarea class="widgEditor" id="DesiredCandidate" name="DesiredCandidate" rows="5" cols="100" onblur="this.value=MakeInitialCapital(this.value);"></textarea> <br></td></tr>
       <tr><td>HR Name:</td><td><input id="HRName" name="HRName" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"> <br></td></tr>
       <tr><td>HR Contact:</td><td><input id="HRContact" name="HRContact" type="text" size="50" onblur="this.value=MakeInitialCapital(this.value);"> <br></td></tr>
       <tr><td>Email:</td><td><input id="Email" name="Email" type="text" size="50"> <br></td></tr>
       <tr></tr>
       <tr><td><input id="Submit" name="Submit" value="Submit" type="submit"> <br></td></tr>
      </table>
     </Form>
    </body>
</html>

<script language="JavaScript" type="text/javascript">
    function MakeInitialCapital(str)
    {
       return str.toLowerCase().replace(/\b[a-z]/g, cnvrt);
        function cnvrt() {
            return arguments[0].toUpperCase();
        }

    }
</script>

For example, if I had typed the company name, say, Example Solutions, then the first line of the above code gets modified as:

Example Solutions <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
A: 

Are you using some kind of server side processing language such as PHP? If so then make sure you don't have an 'echo' statement lurking around dumping the company name. Given the location in the HTML where the company name is being printed my guess is it is happening on the server side and not with JavaScript.

Darrell Brogdon
A: 

I got a new tool: openWYSIWYG

RPK