Refresh form after php code has completed

Refresh form after php code has completed

Unread postby stevem » Thu Jun 26, 2014 8:03 pm

Hello,

I'm having a slight issue with some of the forms I am creating. I have some php code running to build an automatic ID reference (not a Auto Increment Number). The code is working fine, but I want to be able to refresh the form once the client record has been updated with the new unique reference. There is a button that is visible when the client has no reference assigned. The php code runs from the assign reference button.

The manual refresh works fine, but is it possible to call a function from the php code to automate this?

Thanks
Steve
stevem
 
Posts: 8
Joined: Tue Jun 24, 2014 8:29 pm

Re: Refresh form after php code has completed

Unread postby admin » Fri Jun 27, 2014 10:29 am

Steve,

I think you are going about it the wrong way.
Yours steps are..
1. Getting an ID.
2. Saving the record.

I would..
1. Save the record (and On Save of the Form, assign an ID.

It would be much simpler and you would be using nuBuilder the way it was designed to be used.

Steven
admin
Site Admin
 
Posts: 3406
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5

Re: Refresh form after php code has completed

Unread postby stevem » Mon Jun 30, 2014 2:53 pm

Hi,

OK I'll try that approach then.

What function is called when the refresh button is clicked on a form?

Thanks
Steve
stevem
 
Posts: 8
Joined: Tue Jun 24, 2014 8:29 pm

Re: Refresh form after php code has completed

Unread postby admin » Tue Jul 08, 2014 8:32 am

nuReloadForm()

Steven
admin
Site Admin
 
Posts: 3406
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5

Re: Refresh form after php code has completed

Unread postby stevem » Tue Jul 22, 2014 1:25 am

Hi Steven,

Is there anyway I can run the function nuReloadForm() from the runphp or java script event options?

thanks
Steve
stevem
 
Posts: 8
Joined: Tue Jun 24, 2014 8:29 pm

Re: Refresh form after php code has completed

Unread postby admin » Tue Jul 22, 2014 8:39 am

Steve,

I'm sure you are making this much harder than it should be.

Where are you creating this unique id, server side (php) or client side (js).

Can you include a screen shot?

Steven
admin
Site Admin
 
Posts: 3406
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5

Re: Refresh form after php code has completed

Unread postby stevem » Tue Jul 22, 2014 8:01 pm

Hi Steven,

I am basically trying to simulate how an access version of the same form works. So I am using php code to save details and create new id numbers, update age based on DOB etc. which is all working fine. Its nothing to worry about really, but I just wondered if there was a way of refreshing the form so that the data being displayed is current, rather than clicking the refresh link. I can see the java call on the hyperlink which calls nuReloadForm()

I have tried to include the java files within some PHP code, but I cannot seem to call the java function.
Hope you can help.

Thanks
Steve
stevem
 
Posts: 8
Joined: Tue Jun 24, 2014 8:29 pm

Re: Refresh form after php code has completed

Unread postby admin » Wed Jul 23, 2014 8:49 am

Steve,

BTW, Java and Javascript a different things, Javascript is used by nuBuilderPro to manipulate things in your browser, Java is not used at all by NBP.
PHP is used to get to the database and runs SQL to edit data validated by javascript and then sent to the server in a JSON string.
In MS Access, you can do all this with VBA

When ever you Save a record NBP updates the record and redisplays it. There is no reason to refresh your Form.
I'm not sure why you think you need to.

The knowledge of how Access works is only going to hold you back from using NBP properly

Ultimately you will find NBP much easier to use.

Steven
admin
Site Admin
 
Posts: 3406
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5

Re: Refresh form after php code has completed

Unread postby jkdev » Mon Sep 01, 2014 12:35 pm

I hasimilar requirement to generate a reference number automatically.

The way I got around was to create a TRIGGER in MySQL table to generate and assign the value before record is updated (via Save button).

I wonder whether there is an easier way since otherwise I would presume that some interaction would be required between a backend PHP code and Javascript on current form in the browser.
jkdev
 
Posts: 20
Joined: Fri Aug 01, 2014 9:56 pm

Re: Refresh form after php code has completed

Unread postby admin » Tue Sep 02, 2014 7:59 am

admin
Site Admin
 
Posts: 3406
Joined: Mon Jun 15, 2009 9:53 am
nuBuilder Version: 4.5


Return to Custom Code

Who is online

Users browsing this forum: No registered users and 2 guests