Hi,
Can anyone tell me how to retrive a specific vale from the displayed URL and assign it to a field
if so please help me
Thanx in advance
Hi,
Can anyone tell me how to retrive a specific vale from the displayed URL and assign it to a field
if so please help me
Thanx in advance
Subject: Passing a Value to a field through URL
Hi Talluri
If it’s an additional value you’ve added yourself -
something like http://www.db.nsf/talluri?openform&day=tuesday
then to retrieve the “day” value from that URL what we do is:
Add a CFD field called Query_String with a value of Query_String
Add a CFD field called QueryList with a value of:
sParams := @ReplaceSubstring( @RightBack(Query_String; 9); “%20”; " ");
@Explode( @Explode( sParams; “&” ); “=” )
The add any field name you want, editable, CFD or whatever, and the value would be:
loc:=@Member(“day”; QueryList);
@If(loc=0; “”; @Subset(@Subset(QueryList; loc+1); -1))
It might look long-winded, but it’s grown over time here, to allow us to get whichever variable/value we need as we build things up.
If you need to do it in JS, instead of @formulas, let me know, I can post that too.
Mark
LogicSpot
UK
Subject: Use Query_String_Decoded, not Query_String
To avoid having to deal with URL Decoding all kinds of characters (e.g. %20 and + for space), always use the “Query_String_Decoded” CGI field, not “Query_String”
Subject: RE: Passing a Value to a field through URL
Hi mark!
Thanx for the code i feel quite comfortable with the formula language … i will be very happy if u could even give me the javascript … because i have to use the code even in the NON Notes pages also.
Thanx in advance
Sri
Subject: RE: Passing a Value to a field through URL
Hi Talluri,
No worries, glad I could help!
In JS, you could use the following:
sRet = argItems(day)
function argItems (theArgName) {
sArgs = location.search.slice(1).split(‘&’);
r = '';
for (var i = 0; i < sArgs.length; i++) {
if (sArgs[i].slice(0,sArgs[i].indexOf('=')) == theArgName) {
r = sArgs[i].slice(sArgs[i].indexOf('=')+1);
break;
}
}
return (r.length > 0 ? unescape(r).split(',') : '')
}
Subject: RE: Passing a Value to a field through URL
Hi Mark…
Thanx for your help …
Rgds
Sri
Subject: RE: Passing a Value to a field through URL
Talluri,
If you need more help/advice, you can eMail me anytime at:
mark at logicspot dot com
I’ll help you or pass it on to one of the guys!
Regards
Mark
LogicSpot
UK