Questions and discussion about using ProcessMaker: user interface, running cases & functionality
#817612
Hi Amo,

I'm using PM 3.2.2 web entry form, and my web-entry form is like this :

https://192.168.1.77/syscos/en/neoclass ... hp?foo=abc

and as you can see I add a parameter foo at the end of the url, because I want to use this parameter in my dyanform, any ideas how to pass this parameter into the dynaform by using js? or can I use a trigger before the dyanform?

Appreciate your ideas.

Yxu
#817613
Hi,

Because of the web entry structure, you can not directly get the parameters from the URL, so you can do the same as the javascript code below:
Code: Select all
function GetURLParameter(sParam){
  	var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++)
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam)
        {
            return decodeURIComponent(sParameterName[1]);
        }
    }
	return '';
}

$("document").ready( function(){
	if(step_mode == undefined || step_mode != 'VIEW'){
		var foo = GetURLParameter('foo').replace(/\-/g, '/');
		$('#hidden_foo').setValue(foo);
	}
});
Thanks
#817615
programerboy wrote: Mon Nov 05, 2018 1:17 am Hi,

Because of the web entry structure, you can not directly get the parameters from the URL, so you can do the same as the javascript code below:
Code: Select all
function GetURLParameter(sParam){
  	var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++)
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam)
        {
            return decodeURIComponent(sParameterName[1]);
        }
    }
	return '';
}

$("document").ready( function(){
	if(step_mode == undefined || step_mode != 'VIEW'){
		var foo = GetURLParameter('foo').replace(/\-/g, '/');
		$('#hidden_foo').setValue(foo);
	}
});
Thanks
Hi Programmerboy,

thanks for the code.

But it seems i still got empty value.
Code: Select all
function GetURLParameter(sParam){
  	var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++)
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam)
        {
            return decodeURIComponent(sParameterName[1]);
        }
    }
	return '';
}

$("document").ready( function(){
	if(step_mode == undefined || step_mode != 'VIEW'){
		var foo = GetURLParameter('foo').replace(/\-/g, '/');
		$('#test').setValue(foo);
	}
});
Can we use php trigger and fired before the web-entry form? Because I need to get the list of the names from the DB according to the URL parameters.

Thanks,
Yuan
#817700
Hi,

I tested this code again and it was correct.
I could not get the data from the url via the trigger before the form, But you can use Ajax and get data from database base on "foo" value.

The tested code is:
Code: Select all
function GetURLParameter(sParam){
  	var sPageURL = window.location.search.substring(1);
    var sURLVariables = sPageURL.split('&');
    for (var i = 0; i < sURLVariables.length; i++)
    {
        var sParameterName = sURLVariables[i].split('=');
        if (sParameterName[0] == sParam)
        {
            return decodeURIComponent(sParameterName[1]);
        }
    }
	return '';
}

$("document").ready( function(){
	if(step_mode == undefined || step_mode != 'VIEW'){
		var foo = GetURLParameter('foo');
		$('#hidden_foo').setValue(foo);
	}
});
You must define a text input or hidden input like "hidden_foo" in your form.

Thanks

A 1xbet clone script is a pre-designed software so[…]

4rabet clone script is enabling entrepreneurs to e[…]

Parimatch clone script is enabling entrepreneurs t[…]

In the world of cryptocurrency, a wallet is an app[…]