I have created 2 pages in asp.net login and signup.
Now I want to check whether the username entered is already present before inserting data into database on signup page. I want to do this validation using javascript.
I tried doing it using compare validator but it did not worked.
Here are some way to do this.
You send all the username to the javascript when the page load and validate against the username list.
You make an AJAX query to your server to validate the username from the client side.
When the user submit the signup form, you validate the username received against your database and send an error if you find it.
You can use ajax to call a server side method that verify if the username already exist. This can be done very easy with JQuery. Look at the documentation here: http://api.jquery.com/jQuery.ajax/
Related
I created a sketchware app with form and login. So I want to send my login form to my mail and am having issues with that. Ive tried using the intent function and I dont know how to use the firebase option to host my database
Using Intent, set data :yourmail#here.com, you can send data via email.
I am trying to make a sign up and login forms in a project that follows MVC pattern. So we can divide the process into 3 parts: 1- the front-end which is html,css and javascript. 2-Server-side which is PHP 3- database which is MySQL. The problem I have is that when I submit the form either Login or sign up I get a strange behavior that depend on the values i'm sending to the PHP code.
for the sign up process. when I submit the email and password the ajax request send successfully the data and the username and password are correctly inserted into the database, but the on success function is not called. and the page is refreshed.
for the login processes. consider we have an already existing user in database 'user1#gmail.com' and password '1234'. if I entered the correct username and password I get the same behavior as the signup the page is refreshed and on success function is not called and the correct behavior that should happen based on the following codes that it should overwrite the page with the response, but if I send the correct username and password field is empty the onsuccess function is called and write in the document the response 'Hello from login wrong'. In the codes I wrote document.write() function to show only the response but it's not for the real implementation.
There are multiple ways to stop your form from submitting during ajax processing, one easy solution is to change your submit button to a button.
You do this by changing:
type="submit"
to
type="button"
I am sending an HTML email. In the content of that email, I have a submit button.
How do I make sure that the submit button was clicked by the same person to which the email was sent to and not some other person?
In order to achieve that, I will need to parse the email header and extract the email id from it using Javascript.
In short, how can we parse the email header in our Javascript code?
When you send an HTML email, you are just displaying an HTML formatted document to the user through their email client.
The Javascript code cannot parse the email header, in this case, since, the Javascript interpreter lies in the HTML document and doesn't know anything about the email. Anyways, if you want to retrieve the email id from the email header of an email which you have sent yourself, what don't you store it at the time of sending? But, this actually doesn't serve the purpose properly.
You cannot make sure that the submit button was clicked by the same person, since, he can always share the HTML document with somebody.
This type of authentication is not possible. Maybe, if you tell us the problem which you want to solve by this authentication, we can come up with some other form of authentication.
you cannot run JavaScript from your mail but you still can submit forms.
for tracking users you can add to the form action URL the query string with some random number and save this number in a BackEnd before composing the email.
if you have multiple recipients, you have to send the same mail multiple times to 1 recipient at a time with different tracking number in the form.
I have a member profile page which displays an username in regular text,(h1). I can capture the username using Javascript using this code
<script type="text/javascript">
var userID = document.getElementsByClassName("display-name")[0].innerHTML;
</script>
Q: What I want to know is, is there a way to get that variable and sent it back to my database? And add the username if it's an unique username.
P.S.
- I'm running a Wordpress site, database is (phpMyAdmin).
- I've read the $_POST methods for javascript/php transfers. But I don't see how I can apply it here, because there is no form to submit anything in.
- The username gets generated by itself (using a plugin) that's why I'm doing it this way.
You probably want to use an AJAX request and send it back to your server, without having to have a usual form/submit. Check this jQuery Ajax POST example with PHP
Hi I am using this form validation Plugin to validate a form
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
I need to check one email field valid and it exists in db or not.
any solutions appreciated !
First use that plugin to validate if email field is correct. After that use for example .ajax()-function from jquery to send validated email to server. I don't know what is your backend, so it is hard to say how exactly you should do the backend part, but basicly you need to do database query which checks if email is in the database or not. After that function can return value to client and so on...