Welcome to the nuBuilder forums!

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

Access form from a url with autoconnect

Post Reply
ltrannoy
Posts: 19
Joined: Sat Jul 26, 2014 10:09 am
Location: France

Access form from a url with autoconnect

Unread post by ltrannoy »

Hi,

I modified the code and nucommon.js index.php to allow direct access to a form and registration.
It certainly deserves to be optimized or corrected.

I use the parameter "f".

index.php
Line 33: $k = isset($_GET['k']) ? $_GET['k'] : ''; $f = isset($_GET['f']) ? $_GET['f'] : ''; // LTR : direct access to a form
Line 59: window.nuPrimaryKey = '$k'; window.form_id = '$f'; // LTR : direct access to a form
Line 118: toggleModalMode(window.nuPrimaryKey, window.form_id); //toggleModalMode(); // LTR : direct access to a form
Line 120: nuLogin(window.nuUsername, window.nuPassword, window.nuPrimaryKey, window.form_id); // nuLogin(window.nuUsername, window.nuPassword, window.nuPrimaryKey);

nucommon.js
Line 138: function toggleModalMode(k,f){ //function toggleModalMode(){ //-- login screen // LTR : direct access to a form
Line 268: nuLogin(undefined,undefined,k,f); // nuLogin(); // LTR : direct access to a form
Line 276: e.setAttribute('onclick', 'nuLogin(undefined,undefined,"'+k+'","'+f+'")'); // e.setAttribute('onclick', 'nuLogin()'); // LTR : direct access to a form
Line 1543: function nuLogin(u, p, k, f){ //function nuLogin(u, p, k){ // LTR : direct access to a form
Line 1553: if(typeof u == "undefined" || typeof p == "undefined"){ //if(arguments.length == 0){ // LTR : direct access to a form
Line 1576: toggleModalMode(k,f); //toggleModalMode(); // LTR : direct access to a form
Line 1580: window.nuFORM.form_id = f == '' ? data.DATA['index_id'] : f; //window.nuFORM.form_id = data.DATA['index_id']; // LTR : direct access to a form
Line 1589: //w.record_id = '-1'; // LTR : direct access to a form

Many greetings
Attachments
Screen Shot 08-13-15 at 11.09 AM.JPG
Screen Shot 08-13-15 at 11.09 AM.JPG (230.32 KiB) Viewed 9304 times
israelwebdev
Posts: 21
Joined: Thu May 22, 2014 6:08 pm

Re: Access form from a url with autoconnect

Unread post by israelwebdev »

Thanks!
I was able to do some cool stuff with this, such as showing the permalink in the Location bar...

Code: Select all


<script>

function nuLoadEditGlobal(){

	nuOnLoad();
	if (window.top === window.self) {
	    if(window.location.search.indexOf('?i=')>=0)
		window.history.replaceState('',document.title,'?f='+nuFORM.form_id+'&k='+nuFORM.record_id);
	    else
		window.history.pushState('',document.title,'?f='+nuFORM.form_id+'&k='+nuFORM.record_id);
	}
}


admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Access form from a url with autoconnect

Unread post by admin »

.
Post Reply