This topic is locked
[SOLVED]

 Problem with Code Customization in PHPRUNNER 5.3 b 7113

1/3/2011 10:40:33 PM
PHPRunner General questions
B
bobotoh author

[size="4"]*
I put javascript API on
JavaScript Onload event* to disable some AUTOFILL field in my add page to prevent users manually input the fields. IT WORKS on add page and no error occur when i click the save button. Field [color="#0000FF"]NO_RANGKA and value.

var ctrlRangka = Runner.getControl(pageid, 'NO_RANGKA');

var ctrlAhmCode = Runner.getControl(pageid, 'TYPE_AHM_CODE');

ctrlRangka.setDisabled();

ctrlAhmCode.setDisabled();

End


[b]screenshot 1:**


.. but when i browse the database using my Database editor, both field NO_RANGKA and field TYPE AHM CODE are empty. Is It a bug??
screenshot 2:


Note: i tried to delete the javascript from Javascript onloaad event and everything works fine (all fields enabled and field values sucesfully inserted to database)
[size="4"][color="#FF0000"]PROBLEM 2: Custom Code in [b]After record added . [/b][/size]
I want to update a field in another table with this code:

$sql = "UPDATE mst_unit_smh SET unit_status= 'SOLD' WHERE no_mesin=" . $values["NO_MESIN"];

CustomQuery($sql);


error happened on add page when i click the save button :


... i tried to manually use the query in third party MySQL editor :

UPDATE mst_unit_smh SET unit_status= 'IN STOCK' WHERE no_mesin='JB91E2379188'


Success.. The query update unit_status field in the mst_unit_smh table ( just add the ' sign in the beginning and end of JB91E2379188
[size="4"].[/size]
I want insert records to another table with this code:

global $conn;

$strSQLInsert = "insert into sls_kng_confirm (CUST_ID, NO_SPK, NO_MESIN, NO_RANGKA, TYPE_AHM_CODE) values (".$values["CUST_ID"].", ".$values["NO_SPK"].", ".$values["NO_MESIN"].", ".$values["NO_RANGKA"].", ".$values["TYPE_AHM_CODE"].")";


... AN RETURN ERROR:


what's wrong with my code?

Sergey Kornilov admin 1/4/2011

Problem 1
disabled fields are not submitted with the form and won't be updated.

More info:

http://www.w3.org/TR/html4/interact/forms.html#h-17.12
You need to enable those fields.
Problems 2 and 3.
In SQL Query text values must be wrapped by single quotes.
Wrong:

$sql = "UPDATE mst_unit_smh SET unit_status= 'SOLD' WHERE no_mesin=" . $values["NO_MESIN"];


Right:

$sql = "UPDATE mst_unit_smh SET unit_status= 'SOLD' WHERE no_mesin='" . $values["NO_MESIN"] . "'";