Page 1 of 1
Show message on add page instead of form
Posted: Fri Jul 26, 2024 10:37 am
by cosmic_goo
Hi,
I want to be able to stop adding a record (and display a message) to a page if an option in the database is selected.
So say one of my pages is http://localhost/test/pageadd and I have another table with the database record saying whether that page was accessible or not.
Which server even should I use (i.e. Page_Load / Page_Render etc) to check the "access flag" and if disabled show a message and if not continue to load the rest of the Add Page form?
Thanks
Re: Show message on add page instead of form
Posted: Fri Jul 26, 2024 11:08 am
by mobhar
You may use Page_Render server event that belongs to the Add Page.
Re: Show message on add page instead of form
Posted: Tue Aug 06, 2024 4:37 pm
by cosmic_goo
i actually want to use Page_DataRendering as I want the rest of the page to load, but I just want the form to not be displayed. how do I change the visibility of the whole form?
// Page Data Rendering event
function Page_DataRendering(&$header)
{
$hideForm = TRUE;
if ($shedhideFormClosed) {
$this->FORM_NAME->Visible = false; // Hide the entire form
}
}
Re: Show message on add page instead of form
Posted: Wed Aug 07, 2024 9:19 am
by arbei
There is no $this->FORM_NAME
, the form object is a JavaScript object, not PHP object. So you may use Startup Script to hide the form, e.g. if table name is "cars", $("#fcarsadd").hide()
.
Re: Show message on add page instead of form
Posted: Wed Aug 07, 2024 11:17 am
by cosmic_goo
Thanks... I ended up hiding the form as well as the individual fields:
$hideForm= TRUE;
if ($hideForm) {
echo '<style>#form_id { display: none !important; }</style>';
$this->field_1->Visible = false; // Hide field
$this->field_2->Visible = false;
$this->field_3->Visible = false;
[...]
}