Hidden element still appearing in Inline Add/copy

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

Hidden element still appearing in Inline Add/copy

Post by oahmed »

Hello everybody,

I am using PhpMaker 12.

I have a table called Kits and it has an ID (Primary key). The field “ID” is not intended to be completed by the user but its value is automatically added to the database using the Sever Event->Table Specific->Add/copy Page->Form_CustomValidate
With the following code

function Form_CustomValidate(&$CustomError)
{
$GLOBALS["Kit]->ID->CurrentValue = time().rand(1,9);
return TRUE;
}

I also set the ID element’s in the client scriptstable specificAdd/copy pageStartup Script
document.getElementById('x_ID').style.visibility = "hidden";

The code above works well for Add page as single record. However, when I want to do inline add, grid add, the field “ID” is visible and allows user to input. Also for the inline copy, when I click inline copy or copy, the new record created shows the ID for the original record where it is copied from.

Given the ID value is handled by the Custom validate function, I would like your help on how to

a) Make the ID element in “Inline Add” invisible
b) Make the ID element “Grid Add” invisible
c) Don’t copy the ID value from “Inline Copy or Copy” when creating a new record

Thank you very much for your help

Best,
OA.


arbei
User
Posts: 9356

Post by arbei »

Note that inline Add/Edit/Copy and Grid Add/Edit is under list page, and you should place your code in list page to hide the controls.


oahmed
User
Posts: 7

Post by oahmed »

Thanks,

I have tried putting the following code in Client Scripts->List Page ->Startup Script

document.getElementById('x_ID').style.visibility = "hidden";

But still it shows the "ID" field textbox when I click "Inline Add" button.
I have also tried to remove the "Add Page" checkbox of the ID in the Field pane but the ID textbox control is still appearing

Anything else that I am missing?

Thanks,
Oahmed


mobhar
User
Posts: 11703

Post by mobhar »

You need to inspect the element id for "Inline Add/Copy", since it is not the same as in the single "Add Page".


Post Reply