CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 [Solved] javascript and editable grid issue version 4.3

Print topic Send  topic

Author Message
telmiger

Posts: 61
Posted: 01/03/2012, 11:57 AM

I am using the below javascript to copy from a text box into hidden text boxes of editable grid rows when clicking the update button. The code works great on several pages with editable grids but not on on the last one I built. I am getting the initproject_charges element is not defined error.


<script language="javascript">
function copy1OnClick()
{
initproject_chargesElements();
var counter;
for(var j = 0; j < project_chargesElements.length; j++){
project_chargesElements[j][project_chargesinvoice_numberID].value = document.project_charges.invoice_number3.value
}
}
</script>

There is only one difference I see that could cause this to work on one page but not on the other. The question is how can I force CCS to generate a similar code on the page that does not work

On the page that works has the following autogenerated code in the <page>.php

FormScript Method @45-384120A3
function FormScript($TotalRows)
{
$script = "";
$script .= "\n<script language=\"JavaScript\" type=\"text/javascript\">\n<!--\n";
$script .= "var evidence_custodyElements;\n";
$script .= "var evidence_custodyEmptyRows = 0;\n";
$script .= "var " . $this->ComponentName . "project_idID = 0;\n";
$script .= "var " . $this->ComponentName . "evidence_idID = 1;\n";
$script .= "var " . $this->ComponentName . "select_recordID = 2;\n";
$script .= "var " . $this->ComponentName . "custody_type_idID = 3;\n";
$script .= "var " . $this->ComponentName . "insert_employee_idID = 4;\n";
$script .= "var " . $this->ComponentName . "date_11ID = 5;\n";
$script .= "var " . $this->ComponentName . "instrumentation1ID = 6;\n";
$script .= "var " . $this->ComponentName . "results1ID = 7;\n";
$script .= "\nfunction initevidence_custodyElements() {\n";
$script .= "\tvar ED = document.forms[\"evidence_custody\"];\n";
$script .= "\tevidence_custodyElements = new Array (\n";
for($i = 1; $i <= $TotalRows; $i++) {
$script .= "\t\tnew Array(" . "ED.project_id_" . $i . ", " . "ED.evidence_id_" . $i . ", " . "ED.select_record_" . $i . ", " . "ED.custody_type_id_" . $i . ", " . "ED.insert_employee_id_" . $i . ", " . "ED.date_11_" . $i . ", " . "ED.instrumentation1_" . $i . ", " . "ED.results1_" . $i . ")";
if($i != $TotalRows) $script .= ",\n";
}
$script .= ");\n";
$script .= "}\n";
$script .= "\n//-->\n</script>";
return $script;
}
//End FormScript Method


The page that does not work only has the following auto generated code in the <page>.php
The above script seems to initialize the Elements array the code below doesn't. Again what forces CCS to generate the code like above?


//FormScript Method @2-59800DB5
function FormScript($TotalRows)
{
$script = "";
return $script;
}
//End FormScript Method

View profile  Send private message
solesz

Posts: 137
Posted: 01/03/2012, 2:49 PM

Just an idea: maybe you set up - accidentally - the custom insert/update/delete on page where your code does not work...
I mean on editable grid - data panel
View profile  Send private message
telmiger

Posts: 61
Posted: 01/03/2012, 5:13 PM

I just figured it out.

I added the client function <Validate form> on submit. This added all the code in the page to make my java-script code work.
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.