Since there has been no updates on this question in the Tips and Tricks Section of the forum, I would like to bring this up to the General questions.
I want to add a button to Add/Edit page, similar to this one. With PHPr6, I started with the Insert Button wizard on the Editor page for the Add page. My table is the well known carscars , one of the included templates.
Caption: Add and View
Server code:
global $conn;
$strid = "select max(id) as max_id from carscars";
$rsid = db_query($strid,$conn);
$dataid = db_fetch_array($rsid);
$result["id"] = $dataid["max_id"]+1;
Client After code:
window.location.href='carscars_view.php?editid1='+result["id"];
The Client Before code is the most difficult part for me.
I tried:
this.setEnabled();
document.getElementById("saveButton1").click();
But it does not check whether required fields are empty, or validates fields that are set to be validated on the Editor page (date, number, zip code...). Could anyone help on this? Your input is highly appreciated. Thanks.