I have a website which uses a multi-step Contour form. When the user clicks "Next" i would like to get the URL so they can return back to the same step if they have not completed the form.
At present if the page URL is http://currentsite.com/questionnaire/qa1.aspx (qa1.aspx is the page that holds the Contour form) it returns back to the same step, if i close my browser and navigate back to the samem page.
My concern here is if the user deletes their cookies this would mean they cant return to the form again by browsing to the same page.
So how could i create the URL to return the user back to the step/page on a partially submitted form?
If the user has to log in, I would recommend that you store the form information in a database, associated with their login information.
Related
I am new to struts2. I am working on the struts2 with spring application.
I developed user registration functionality. In this registration process have the 3 steps(3forms). First page is step1 contains some fields, second page is step2 contain some other fields and step3 contains some other fields.I used session map in the action class to put the all field values of all forms.After submission form in step3 it goes to call rest service and give the response.If the response is OK then i am redirecting to success page step4. In some cases if user is already exits then it gives response existed user then am redirecting to step5 page. In this page i used one message " Sorry the user is already exists" and with one link "Home Page".
I used this link <s:a id="next" href="/sample/register/user.action"> Homepage </s:a> in step5 page. After clicking on this link it goes to homepage(means step1 page) fine,but it doesn't contain user entered values. I have to maintain all field values in the step1,step2,step3 process. How to achieve this problem.
Please any one can give suggestion.
IF you are using session map to persist values being entered by the user, i believe they should be available in the session until you have not removed them from the session or session expired.more over when you do redirect a new request -response cycle started by the framework and a new value stack will be created that means all old values will be lost.
From your description i believe you are creating a wizard like functionality and if this is the case i believe struts2 provide a more elegant and flexible solution
ScopeInterceptor
This is designed to solve a few simple issues related to wizard-like functionality in Struts
Still you need to show how you trying to show the values in the form being filled by the user if something fails or when user is already exists in the system as described in your case.In this case you need to fetch object/data from the session.
I have a controller that returns
System.Web.Mvc.FilePathResult
I do return this.File(filename, contentType, download name);
This action is called when user is clicked on a link and
I have made $("a[rel='popup']").colorbox();
.So whenever a user clicks on the links
It takes to the controller method and the file
Shown in the colour box.
Now I am facing an issue it is like
If a user is logged in to my site and open a page
, where links are shown and the user goes away from his seat (ie session expires)
Then he come back and clicks on the link
.At that time my application breaks as there is no valid session.
So tried to return View("LogOn");
when session is null.
But as still it is not redirected to the
I think it is because of the colorbox
Can anyone suggest any thing such that I should be redirected to the log in page
Even if I am taking a Color box
?
When a session expires, it will not be "null", so if you're checking if (Session == null), this won't work. You'll need to check for the presence of a session variable instead.
In your comment you say you're tried redirecting to /Home/Login but it doesn't render the login view. Can you elaborate? What does it render?
my question seems simple and stupid
but first read this,
suppose you have a login form which take username and password and post back to controller
if login successful then return Homepage(return View("HomePage")) View (not Redirect) then suppose i am Logged off
and return Login (return View("Login")) View (again not Redirect) and now if i press Back button and Refresh the page then it will automatically get logged IN by using those username and password which i entered before.
So can i make those password Null from Browser's Memory or where ever it is i don't know.
"i know that not redirecting (RedirectToAction("ViewName")) is causing the problem" But Why or May be i don't know any important concept
Some browsers, especially Firefox try to be helpful and 'remember' values you have input into text fields and checkboxes. in order to switch this off in a particular input add the following attribute
autocomplete="off"
Alternatively, using jQuery you can switch it off for a whole form:
$("form").attr("autocomplete", "off");
ModelState.Remove("key");
or
ModelState.Clear()
I have a page "Results" with a form and when "submit" is clicked, the form is submmited to another Action. So far, so good...
But, this works fine just if user is logged in. If not, he will be redirected to "Login" page and my FormCollection loses its data.
Is there a way to persist this data without using TempData??
Thanks!!
I don't think that's possible. The only thing the system remembers during the redirect to the login page is the 'return url'. No post data is saved (this could be megabytes of data...)
You can use the Session object as alternative, or make sure that the user is logged in before you post.
Or, if it's just a search result, try to live without the POST, and use a GET (which also has other advantages)
I would prefer to disallow unauthorized user to visit "Results" page or at least to show him message "Please login first" instead of the form.
is there a way to get the referer with the anchor from the referer page..
the situation is - i have a search page which loads results (users) below the search box using ajax. i am changing the hash/anchor on the fly when the search keyword is typed in.
so it becomes http://localhost/users/search#foo
the user gets link in the ajax result to edit the user. i want the user to come back to this same search result after he is done editing the user.
Anchors are not included in the referrer. You'll need to use query parameters or define the return URL (with the anchor) in the session before updating the user.