CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 how to display insert button on InsertAllowed = false;?

Print topic Send  topic

Author Message
oasisp

Posts: 38
Posted: 02/21/2017, 3:54 PM Quote message

i have some custom code to check duplicate on insert on BeforeInsert I have following

$additems->InsertAllowed = false;

but when I try insert it won't show Button_Insert after I submit.

how can I seee Button_Insert all the time to try another insert.

I have tried following but still not displaying

$additems->Button_Insert->Visible = True;
$additems->Button_Insert->Show();
View profile  Send private message
MichaelMcDonald

Posts: 601
Posted: 02/22/2017, 4:59 AM Quote message

can you place the duplicate checking in the on validate event and not worry about hiding the button ?

I say this as I suspect the button would need to be hidden in the forms beforeshow event...
_________________
Central Coast, NSW, Australia.

Use the EXETA Online Business Valuation Tool to
value your business.

www.exeta.com.au
View profile  Send private message
eratech


Posts: 513
Posted: 02/22/2017, 5:53 PM Quote message

@oasisp - agree with Michael - put that into the OnValidate of the form.

You don't need to force the InsertAllowed = false as that will hide the button (as you found)

If you are validating you can either add an Error to the form (which will stop the insert and return to the form, with error message):

if ($Form1->TextBox1->GetValue() < 10 or $Form1->TextBox1->GetValue() > 50) {  
    $Form1->Errors->addError("The value must be greater than 10 and smaller than 50");  
  }  

or you can return 'false' from the BeforeInsert function which will usually not carry on the Insert

or you can use the 'DataSource->CmdExecution' flag (see the DataSource properties of the Record). I think this the sort of thing you were trying to do, as it will directly stop the Insert/Update/Delete, without affecting the overall form. It is particularly useful with Editable Grid where you want to process many items, and fail a few instead of failing the entire grid.

Cheers

Eric

I
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia
View profile  Send private message

Add new topic Reply to topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.