Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
By sgkalluri
Hello everyone,

I have a textbox in a dynaform that is populated by execution of its related sql query (defined in the textbox control).

Is there a way by which I can prevent the execution of the query based on certain conditions when the DynaForm is loaded for the user?

Best wishes,
There is no way that I know to prevent an SQL query from happening when the DynaForm loads, but you can use JavaScript to clear the contents of the field after the query takes place:
if a textbox or textarea, then use this code:
Code: Select all
if ( /*some condition*/ ) {
If a dropdown, checkgroup, radiogroup or suggest box, then use this code to clear the list of options set by the SQL query:
Code: Select all
if ( /*some condition*/ ) {

See: viewtopic.php?f=47&t=710111
Thanks a lot Amos!

I experimented by writing the SQL query in the following manner:

Select abc from def where (1 = @=xyz)

Where the @@xyz variable is set to 1 in JavaScript when certain conditions are met when the form is loaded and to any other value when those conditions are not met.

However, you are right. The query does have to execute. It just does not return a value.

Best wishes,

Hello! If you did not find the mcrypt extension […]

Hello! You have a mistake in the url, the correct […]

objects variable in grid

Hello! It is very rare since I could not replicate[…]

Hello! It is likely that the design you are doin[…]