Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Form without Table Topic is solved

Questions related to using nuBuilder Forte.
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Re: Form without Table

Unread post by oli »

The Form will be opened from the default home form by using a RUN button (New Breadcrumb - but I also tried other options)
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Form without Table

Unread post by kev1n »

I cannot replicate it here...

I created a Launch form with this code in PHP BE:

Code: Select all

$j = "nuMessage('Hello from nuBuilder!');";

nuAddJavascript($j);
The message is always shown, no matter how the form is opened (via run button, as user home, open the form with parameters), tried with globeadmin and normal user.

Can you create a simple test form and export its sql with the cloner?
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Re: Form without Table

Unread post by oli »

This is the cloned Form - created for testing purpose:

Code: Select all

-- nuBuilder cloner SQL Dump
-- Version 1.21
-- Generation Time: December 19, 2021 09:02:56 AM

-- Form Description: Testform
-- Form Code: form_testform
-- Form Table:
-- Form Type: launch


--
-- zzzzsys_form: form_testform_clone_1
--

INSERT INTO zzzzsys_form (zzzzsys_form_id, sfo_type, sfo_code, sfo_description, sfo_breadcrumb_title, sfo_table, sfo_primary_key, sfo_browse_redirect_form_id, sfo_browse_row_height, sfo_browse_rows_per_page, sfo_browse_title_multiline, sfo_browse_autoresize_columns, sfo_browse_sql, sfo_javascript, sfo_browse_javascript, sfo_edit_javascript) 
VALUES ( '61bf025f2007ee9', 'launch', 'form_testform_clone_1', 'Testform', NULL, NULL, NULL, NULL, NULL, NULL, '0', NULL, NULL, NULL, NULL, NULL ); 

--
-- zzzzsys_tab
--

INSERT INTO zzzzsys_tab (zzzzsys_tab_id, syt_zzzzsys_form_id, syt_title, syt_order, syt_help, syt_access) 
VALUES ( '61bf025f2025dfe', '61bf025f2007ee9', 'Main', '10', NULL, NULL ); 

--
-- zzzzsys_php
--

INSERT INTO zzzzsys_php (zzzzsys_php_id, sph_code, sph_description, sph_group, sph_php, sph_run, sph_zzzzsys_form_id, sph_system, sph_global, sph_hide) 
VALUES ( '61bf025f2007ee9_BE', '61bf025f2007ee9_BE', 'System PHP', 'nubuilder', '$j = \"nuMessage(\'Worked!\');\";\nnuAddJavascript($j);', NULL, NULL, '1', '0', NULL ); 
It shows the same behaviour - only after refreshing the page I get the output "Worked!".

My workaround is to set a variable in the PHP code and check in JavaScript if the variable was set. If not, the page will be refreshed to force the execution of the PHP code:

Code: Select all

if(typeof php === 'undefined'){
    nuGetBreadcrumb();
}
kev1n
nuBuilder Team
Posts: 4297
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Form without Table

Unread post by kev1n »

Try this fix:

Edit nuform.php, starting from line 109

Replace:

Code: Select all

	if($RID != ''){

		$p = nuProcedure('nuBeforeEdit');	
		if($p != '') { eval($p); }
		if(count($_POST['nuErrors']) > 0){return;}

		nuEval($FID . '_BE');

	}
With:

Code: Select all

		$p = nuProcedure('nuBeforeEdit');	
		if($p != '') { eval($p); }
		if(count($_POST['nuErrors']) > 0){return;}

		nuEval($FID . '_BE');

	
oli
Posts: 118
Joined: Sat Mar 20, 2021 3:22 pm
Has thanked: 4 times

Re: Form without Table

Unread post by oli »

Yes ... it's working!!

Thanks kev1n !
Post Reply