Page 1 of 1

Refresh form after php code has completed

Posted: Thu Jun 26, 2014 12:33 pm
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

Re: Refresh form after php code has completed

Posted: Fri Jun 27, 2014 2:59 am
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

Re: Refresh form after php code has completed

Posted: Mon Jun 30, 2014 7:23 am
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

Re: Refresh form after php code has completed

Posted: Tue Jul 08, 2014 1:02 am
by admin
nuReloadForm()

Steven

Re: Refresh form after php code has completed

Posted: Mon Jul 21, 2014 5:55 pm
by stevem
Hi Steven,

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

thanks
Steve

Re: Refresh form after php code has completed

Posted: Tue Jul 22, 2014 1:09 am
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

Re: Refresh form after php code has completed

Posted: Tue Jul 22, 2014 12:31 pm
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

Re: Refresh form after php code has completed

Posted: Wed Jul 23, 2014 1:19 am
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

Re: Refresh form after php code has completed

Posted: Mon Sep 01, 2014 5:05 am
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.

Re: Refresh form after php code has completed

Posted: Tue Sep 02, 2014 12:29 am
by admin
jkdev,

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

Steven