On Cancel button click, return to view name passed in query string
Posted on 2006-11-13
I have a form that I am trying to return to a certain view when either the Submit, Update or Cancel buttons are pressed. I pass the viewname as a query string parameter and have a field on the form called ViewName (code below).
In the cancel button I have the following code:
@URLOpen(Path +"/" +@Text(ViewName) + "?OpenView&RestrictToCategory=" + Component)
The ViewName field works because I can display it on the page, however when I click the Cancel button, the ViewName field returns an empty string, causing the URLOpen to fail. Why would this be? How can I resolve this problem?
Parameter := "viewname";
NotFound := "";
ArgNames := @Left(@Explode(@Right(Query_String_Decoded;"&");"&");"=");
ArgValues := @Right(@Explode(@Right(Query_String_Decoded;"&");"&");"=");
REM "Check that the parameter exists";
Position := @Member(Parameter; ArgNames);
@If(Position > 0;
@Trim(@Subset(@Subset(ArgValues; Position); -1));