telmiger
Posts: 61
|
| Posted: 04/07/2005, 10:36 AM |
|
I am trying to accomplish the following. I have 2 forms on my page
Form 1 $evidence_custody4 is a dummy form where I enter information to be used in my custom query. The form is not connected to any table and the buttons are disabled.
Form 2 is an editable grid.
I want to enter information into form 1 and then select records with checkboxes on Form 2.
If you hit Submit on the editable grid the custom query should copy the information from Form 1 and the selected records from form 2 into another table.
I added the code below into the After_excecute_update Event from the editable grid. The problem I am having is that the entered information from form 1 is not copied. The code just copies the default values set in each field. I assume that when editable grid event is executed the page gets refreshed and the information in the form 1 is lost.
Is there a way around this or what should I do different?
global $evidence_custody;
global $evidence_custody4;
global $DBcns;
if ($evidence_custody->select_record->GetValue() == 1)
{
$DBcns->query ("Insert into evidence_custody (evidence_id,project_id,custody_type_id,instrumentation_id,comments) VALUES ("
.$evidence_custody->evidence_id->GetValue() .","
.$evidence_custody->project_id->GetValue() .","
.$evidence_custody4->custody_type_id->GetValue() .","
.$evidence_custody4->instrumentation->GetValue() .","."'"
.$evidence_custody4->results->GetText()."'".")");
}
Tony Elmiger
|
 |
 |
Nicole
Posts: 586
|
| Posted: 04/08/2005, 5:25 AM |
|
Tony,
Values entered on Form1 are not available in events of Form2 after its submit. Because Form2 was submitted, not Form1. But you can move input fields from Form1 to Form2 and do not include them into Insert, Update statements.
In this case you cab get that values in event code with CCGetParam() function.
_________________
Regards,
Nicole |
 |
 |
telmiger
Posts: 61
|
| Posted: 04/13/2005, 11:35 AM |
|
Thank you Nicole for pointing me into the right direction.
By accident I found out that you do not need to retrieve the information from your data entry fields and attach them to your variable names if you name the variables the same way as your data entry fields.
In addition I did not have to prescreen the fields for characters that could mess up the insertion into the database or enclose the text fields with ''.
Below is my code I put into the after execute update event
global $evidence_custody;
global $DBcns;
$EmpProjectConn = new clsDBcns();
global $instrumentation; // same name as the added data entry field
global $date_1; // same name as the added data entry field
global $results; // same name as the added data entry field
global $custody_type_id; // same name as the added data entry field
if ($evidence_custody->select_record->GetValue() == 1)
{
$DBcns->query ("Insert into evidence_custody (evidence_id,project_id,custody_type_id,instrumentation_id,date_1,comments) VALUES ("
.$evidence_custody->evidence_id->GetValue() .","
.$evidence_custody->project_id->GetValue() .","
.$EmpProjectConn->ToSQL($custody_type_id, ccsInteger).","
.$EmpProjectConn->ToSQL($instrumentation,ccsInteger).","
.$EmpProjectConn->ToSQL($date_1, ccsDate) .","
.$EmpProjectConn->ToSQL($results, ccsText).")");
}
|
 |
 |
|