Link to home
Start Free TrialLog in
Avatar of CRAK
CRAKFlag for Netherlands

asked on

Return to predefined URL after submit

R507; webapplication:

In a document or a view, a user clicks on an action, trigering an agent, passing the users current url through the new url:
http://agentUrl?OpenAgent&SourceUrl=originalUrl
The reason is that -later in- I want to return there.

The agent creates a document in a different database, sets a few fields and saves. Then an new url is composed to open that new documention editmode and -again- passing the original url:
http://newdocUrl?EditDocument&SourceUrl=originalUrl

After filling out some additional fields, the user presses a submit action. The authornames field is now given a different value (the user is not allowed to re-edit the document) and the document is actually submitted.

All this happens in javascript. The annoying thing is that I can't both save the docuemnt and return to the original url (preferably using location.assign()). It's no problem isolating originalURL but when I address it, the doc appears unsaved -even after adressing is AFTER submitting!-. When I only submit (save) the document, the form's action is triggered: the ?EditDocument, logically resulting in an error.

$$Return seems to have no effect on the forms action or what happens.
The onSubmit-event is added to the <FORM>-tag, but has no effect either.

I have done this before. What am I doing wrong this time?
Avatar of HemanthaKumar
HemanthaKumar

At the end of the agent after everything is executed and doc is saved, Execute a print statement like this

Print "[www.Domain.com]"

This will open the page domain.com, this url can be relative too.

Goodluck
~Hemanth
Avatar of CRAK

ASKER

Sorry Hemanth, I know the technique (used it to open the doc in edit mode), but it does not work here....
As I said: I've done it before; there must be something really weird going on here!

In my keyboard as well.... so many typing errors in my question. Can't be me! ;-))


Anyway....
I'll try to involve WebQuerySave: that's the only LOGICAL thing that I haven tried yet. Will let you know tomorrow.
Hello CRAK,

perhaps you mess this: the correct action for storing a document is not ?EditDocument ;-))
The correct one is: ?ComposeDocument

Regards,
zvonko
Avatar of CRAK

ASKER

zvonko,
The document was already created and saved in the back-end. The user only has to fill out one or two additional fields. ?ComposeDocument would create ANOTHER new document.


But I've worked thinks out last night. That URL that is supposed to bring back my original page is retrieved (in javascript) from the URL, using Query_String. In e.g. http://newdocUrl?EditDocument&SourceUrl=originalUrl I locate "&Source=", keep everything trailing it and discard the rest. Then I add "&" at the end, locate the first "&" (more parameters MAY be entered) and isolate everything preceding it, using myUrl.substring(start, end).

The error I made resulted in end=0.

Simple stupidity....

Sorry guys.... mind if I delete this question?
hey, from my side, I do not mind at all <|;-)

Allow me only one joke: the most errors sit in front of the keyboard :-))
Avatar of CRAK

ASKER

I'll check with my parents.... see if they can get my bugs fixed ;-o
Avatar of CRAK

ASKER

Why did you change your name?
this name change was a bug fix ;-)

when I was creating my EE account in 1998 I was checking only the account "Zvonko" (my FirstName). It was in use, so I choose this stupid synonym (stamp, ha ha).
Now I have to pay for this ;-)
The Proppercase name was registered by an Croatian who newer posted nor asked for eneything. But the EE comunity support told me: it is not a problem; take the first letter lowercase and it will work. So, I start now from scratch. Transfering expert points and history is still not possible in EE (I meen: renaming stamp to zvonko). Only offer from EE was to give me question points from stamp...
Avatar of CRAK

ASKER

I found solution myself. The problem wasn't caused by some unexpected program behaviour, but by a simple typing error.

I don't think others will learn a great deal from a silly thing like that.

I can't reward points to either of the participants: I am sure that they both know how to solve a problem as described, but:
- neither mentioned "typing error", and
- rewarding one would be unfair to the other

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Netminder
Netminder

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial