How can i add a custom select?

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
AndreeWOff
User
Posts: 1

How can i add a custom select?

Post by AndreeWOff »

Hi everyone, I'm currently trying to modify an order entry system made in PHPMaker, the problem is that I don't have the .pem files for the project so I'm trying to add an input directly in the code to take the value and save it in the database but it doesn't work for me.

I tried this:

function LoadFormValues()
	{
		// Load from form
		global $objForm;
		$this->GetUploadFiles(); // Get upload files
		if (!$this->idempresa->FldIsDetailKey) {
			$this->idempresa->setFormValue($objForm->GetValue("x_idempresa"));
		}
		if (!$this->idestablecimiento->FldIsDetailKey) {
			$this->idestablecimiento->setFormValue($objForm->GetValue("x_idestablecimiento"));
		}

		// The rest of the fields that pkpmaker generates.................


		if (!$this->idcategoria_orden->FldIsDetailKey) {
			$this->idcategoria_orden->setFormValue($objForm->GetValue("x_idcategoria_orden"));
		}
	}


function AddRow($rsold = NULL)
	{
		global $Language, $Security;
		$conn = &$this->Connection();

		// Begin transaction
		if ($this->getCurrentDetailTable() <> "")
			$conn->BeginTrans();

		// Load db values from rsold
		if ($rsold) {
			$this->LoadDbValues($rsold);
		}
		$rsnew = array();

		// idempresa
		$this->idempresa->SetDbValueDef($rsnew, $this->idempresa->CurrentValue, 0, strval($this->idempresa->CurrentValue) == "");

		// The rest of the fields that pkpmaker generates.................

		// Add idcategoria_orden
 		//$this->idcategoria_orden->SetDbValueDef($rsnew, $this->idcategoria_orden->CurrentValue, NULL, FALSE);


}

This is my HTML Input

<input type="text" name="x_idcategoria_orden" id="x_idcategoria_orden" value="<?php echo $orden_tra->idcategoria_orden->EditValue; ?>">

But but does not save


mobhar
User
Posts: 11905

Post by mobhar »

You should not change/edit the built-in functions/code that generated by PHPMaker.

However, if you want to obviously add your own code based on your business-logic directly into the generated script files, then you should use server event instead.

For example, if you want to add default value for a field, you may simply use Row_Rendered server event:

if (CurrentPageID() == "add") { // implement only for Add/Copy Page
    $this->dcategoria_orden->EditValue = "something"; // assume the field type is not numeric; adjust it to yours
}

Post Reply