My Doubt is as follows I have a static HTML Page(Login.html) with 3 forms in it namely
Login Form
Create Account Form
Forgot Password Form
When the user Types in my correct user email Id an password in the LOGIN Form, the form needs to direct it to a different HTML page namely dashboard.html. When the user Selects forgot Password form, the form will ask the user to enter his email ID and once the user clicks on Submit button the forgot Password Form should redirect it to Login Form in the Login.html file. Both the Forms are in the Single Html Page.
My Question is that How do I redirect from One form to another form in a Single HTML page using Angular JS and Also from one page to another page in Angular JS. I couldn't Find good tutorials on this Issue. So can somebody help me with this issue.
If you need to redirect between forms in a single-page html application, you will need to use routing. Your choices are ngRoute which is a part of AngularJS but a separate module, and ui-router from the AngularUI folks, which I would recommend.
I assume you are handling your login form submission using the ngSubmit directive on the form? If so, check the username/password by whatever means you need to in the scope function assigned to ngSubmit. If the credentials are valid, use the router or the $location service to redirect the user to the dashboard. The link to the forgot password page is a simple link with an ngHref or ui-href, depending on the router you are using.
Your HTML pages will be displayed in the section of the page set aside for views (again, check which router you are using). The HTML pages should be partial pages, not full HTML pages, since they are going to be inserted in the main page of your single page application.
Hope that helps.
Related
I am wondering do I need to support the feature to refresh user form (share the link for it) while editing a user?
The scenario:
1. Admin clicks on edit user;
2. Filled User form loads on URL my-domain.com/user/edit/3;
3. Admin refresh the page;
4. The form loads again with fields filled;
Do I need to support this feature (Admin refresh the page and user data is still there)? Is this an unnecessarily extra?
Example scenario if I do not support this feature:
1. Admin clicks on edit user;
2. Filled User form loads on URL my-domain.com/user/edit;
3. Admin refreshes the page;
4. Admin being redirected back to users list;
I am using React and the question more specific would look like this:
Do the form component need to receive the user in props OR the user form have to load the user from the server itself by URL parameter (userId)?
I would say it's not neccesary.
Do I need to support this feature (Admin refresh the page and user data is still there)? Is this an unnecessarily extra?
Generally when I refresh the page its because I dont want to erase every field.. or the form doesnt have 'reset' button.
i need to know user Find the address where a user entered this page in angular 8 .
for example : this user enter this page from forgetpassword or enter this page from activationCode i must show difrent form for user .
how can i do this ??
I did not quite understand, but from what I could understand you would like to redirect the user to different views depending on if they used /forgetpassword or /activationCode?
If so, just define the routes in your app.router.ts file with the respective components for the front-end view.
I have a Jekyll site and a contact page on which I made a simple form and connected it with service like FormSpree or SimpleForm which automatically sends the responses to my inbox, what I would like to do is redirect to a Thank you for your response page after the form is submitted. Attempted this in many ways like adding event listener to the submit button or using onSubmit or action properties of the form but I was only able to achieve one of the two things, either the form submits or I am redirected to the Thank You Page, unable to perform both when I have no access to the server side script which I could have used for redirection. The form is pretty basic, a few input fields and a submit button. Would appreciate any form of help.
Both services allow a hidden field, in your form, which points to the thank you URL you want to be redirected after submission.
with FormSpree use _next (see advanced features)
<input type="hidden" name="_next" value="https://my-site.tld/thanks.html" />
with SimpleForm use redirect_to (see the sample code in their page)
<input type='hidden' name='redirect_to' value='https://my-site.tld/thanks.html' />
I'm making an online quiz using AJAX. I've made a registration form for a user to input their details, and the php file returns a username if the details are valid. I'm trying to figure out how to go straight to the main quiz page once the form POST works and be able to display the given username on that main page where I will be using another php file to display the quiz questions. Also I'm using a sample php file for the username return and am unable to view or change anything in that.
You don't have to use Ajax if you want to go to another page after POST request
Post the form.
Validate data on server.
If credentials is valid put the username in cookie session which means the user has successfully logged in.
redirect the page to the main page.
I strongly recommend you to read more about PHP authentication and use third party libraries if possible.
NOTE: Using an unhashed value as a credential stored in cookie is completely unsafe.
Apparently you have two pages, one is login form and second is the quiz page. You can save the username to a session(not cookie) from the login page itself and redirect to quiz page upon successful authentication. In quiz page you can easily retain the username from session variable.
The session will long last until a certain period of time that you've mentioned in settings.
You can get this session variable throughout your application.
Using session is pretty straight forward in php, you can read it here on PHP.net
Use password_hash and password_verify (PHP 5 >= 5.5.0, PHP 7 ) with bcrypt for security when saving the passowrds.
please add your code.
you can useheader() function in php to redirect your page to quiz page after getting valid data from user.
I have an Angularjs single page application and now I would like to add a login page to it. Here is my SPA template plunker: http://plnkr.co/edit/WgUDJQNL0YCKWUfXMFsr?p=preview. I need a login page and not a modal(examples are available for login page as modal). User has to view the information page(which is in above plunker) only after logging in. Have gone through various videos and tutorials on this but couldn't find a solution. As am new to angularjs, would be grateful if anyone can provide the code for this.
Thanx in advance!!
Remove the body content from index and put it in a separate file(home.html). Just add a ui-view in the body. In run block route to login page by default. On login success route to your home page using $state.go('home'). Name the tab routes as home.tab1 and home.tab2 for Nested routes.