Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Refresh form after php code has completed

Post Reply
stevem
Posts: 8
Joined: Tue Jun 24, 2014 12:59 pm

Refresh form after php code has completed

Unread post by stevem »

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
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Refresh form after php code has completed

Unread post by admin »

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
stevem
Posts: 8
Joined: Tue Jun 24, 2014 12:59 pm

Re: Refresh form after php code has completed

Unread post by stevem »

Hi,

OK I'll try that approach then.

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

Thanks
Steve
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Refresh form after php code has completed

Unread post by admin »

nuReloadForm()

Steven
stevem
Posts: 8
Joined: Tue Jun 24, 2014 12:59 pm

Re: Refresh form after php code has completed

Unread post by stevem »

Hi Steven,

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

thanks
Steve
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Refresh form after php code has completed

Unread post by admin »

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
stevem
Posts: 8
Joined: Tue Jun 24, 2014 12:59 pm

Re: Refresh form after php code has completed

Unread post by stevem »

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
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Refresh form after php code has completed

Unread post by admin »

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
jkdev
Posts: 20
Joined: Fri Aug 01, 2014 2:26 pm

Re: Refresh form after php code has completed

Unread post by jkdev »

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.
admin
Site Admin
Posts: 2781
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 1 time

Re: Refresh form after php code has completed

Unread post by admin »

jkdev,

This shows how to create incrementing numbers. http://wiki.nubuilder.net/index.php/Has ... mber.23.29

Steven
Post Reply