Hi Abu, I am trying to set a default value on the add/edit form with no success, any ideas why this wouldn't work?
$col["editoptions"] = array("value"=>'" . userValue(null, "username") . "');
Even if I add static number it doesn't work?
$col["editoptions"] = array("value"=>'100');
I have the form options set as;
$opt["add_options"] = array("recreateForm" => true, "closeAfterEdit"=>true, 'width'=>'620');
SAny ideas at all?
Thank you
To set default value, use defaultValue key. Only shown on add dialog.
$col["editoptions"] = array("defaultValue"=>'10');
Great Abu, this works on the edit record but on add new record just pulls through the code, not the value..
$col["editoptions"] = array("defaultValue"=>'" . userValue(null, "username") . "');
When editing it pulls user name through but on new it outputs " . userValue(null, "username") . "
Sorry for the questions I have searched forum and even tried adding $col["addoptions"] = array("defaultValue"=>'" . userValue(null, "username") . "'); to see if it worked..
Thanks you again
I am unable to understand what userValue() actually is.
If it is php function, it should be written as:
$col["editoptions"] = array("defaultValue"=> userValue(null, "username") );
The defaultValue sets the value while adding. In editing, it sets the db fetched value of the record.
If it is JS function, and you will have to use afterFormShow event. Let me know the exact scenario.