How to parse deep link submits

Forum to discuss the Web client version of Servoy.

How to parse deep link submits

Postby Westy » Tue Feb 14, 2012 4:29 am

How can the data contained in the following link be parsed with a Servoy 6.x method? The first name/value pair is not problem. The remaining name/value pairs appear to come through as an object. We need help with the required syntax to parse out those values.

Code: Select all
http://ipaddress/servoy-webclient/ss?s=submits&method=parseSubmits&argument=test&name=John Doe&email=jdoe@xo.com&comments=please help

Dean
Westy
 
Posts: 852
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA

Re: How to parse deep link submits

Postby Gabi Boros » Tue Feb 14, 2012 12:05 pm

the arguments array contains in the first element the value of the 'argument' parameter, and in the second element, the name-value pairing for all arguments
so, for your sample:

arguments[0]: 'test'
arguments[1]['argument'] = 'test'
arguments[1]['name'] = 'John Doe'
arguments[1]['email'] = 'jdoe at xo.com'
arguments[1]['comments'] = 'please help'
Gabi Boros
Servoy
Gabi Boros
 
Posts: 404
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: How to parse deep link submits

Postby Westy » Tue Feb 14, 2012 10:34 pm

Thank you very much. The following now works every time!

Code: Select all
function parseSubmits() {
   forms.leads_data.controller.newRecord();
   forms.leads_data.name     = arguments[0];
   forms.leads_data.name     = arguments[1]['argument'];
   forms.leads_data.name     = arguments[1]['name'];   
   forms.leads_data.email    =   arguments[1]['email'];
   forms.leads_data.comments =   arguments[1]['comments'];
}

I was surprised that leaving out the first two "forms.leads_data.name" lines breaks it.

Dean
Westy
 
Posts: 852
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA

Re: How to parse deep link submits

Postby Gabi Boros » Wed Feb 15, 2012 10:19 am

nice it works,
but the first two lines should not be needed!
can you specify how it breaks without those ?
Gabi Boros
Servoy
Gabi Boros
 
Posts: 404
Joined: Tue Jun 26, 2007 4:03 pm
Location: Timisoara, Romania

Re: How to parse deep link submits

Postby Westy » Wed Feb 15, 2012 4:57 pm

I just tested it again. Leaving out the first two "forms.leads_data.name" lines no longer breaks it. It works as long as the table starts out containing at least one record. If the table contains no records, then it creates a new record, but the parsing fails. This is not a problem for us. So we are all set. Thank you.

Dean
Westy
 
Posts: 852
Joined: Fri Feb 13, 2004 5:27 am
Location: Lynnfield, Massachusetts USA


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 8 guests