Forum Moderators: open

Message Too Old, No Replies

multiple onsubmit

how to create multiple onsubmits

         

paxton

7:57 pm on May 7, 2003 (gmt 0)

10+ Year Member



I am trying to incorperate a few different scripts into my form. My form alone will post entered data into my database when the submit button is pressed.

When I found a few scripts that allowed me to confirm email addresses and check passwords they showed that I needed my form to process a different onsubmit rather than the one to post my data.

How do I do all three?

[edited by: tedster at 8:33 pm (utc) on May 7, 2003]
[edit reason] too much code [/edit]

Yamaha_R1

9:23 pm on May 7, 2003 (gmt 0)

10+ Year Member



Try creating a sub script for the input, then have that script call the other three with the appropriate data.

This required some knowledge of scripts...

Yamaha

jatar_k

9:35 pm on May 7, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Welcome to WebmasterWorld paxton,

as Yahama_R1 says, you can do this all in one script. You would have to decide the order thay should happen in first and where you need them to happen.

The email check could be on the same page as the form (javascript?) and you could call that function and if it succeeds then post to your other script.

How you do them also depends on what language they are in.

What is the password checker for? Is it to find out whether they can view the form or if they can submit it?

The db insert, I would think, should be last.

paxton

5:34 am on May 8, 2003 (gmt 0)

10+ Year Member



I had all my code edited out, otherwise you would have been able to tell what I was trying to do.
Anyhow, My basic form is that of a new registration page. On the form I ask for the basic name, email, user id, and a password. I am trying to accomplish three things.
1. validate the email address is actually a email address. I would love to be able to do this by sending an automated email to the person in which they would have to click on a link to be completely registered, like I had to do here at webmasterworld.
2. verify that the password they first entered matches the second form entry of confirm_password.
3. post all the data to my database.

I know not much about javascript, so when it is suggested that I "Try creating a sub script for the input, then have that script call the other three with the appropriate data" I have no clue as to how to do this. I tried reading a few articles but had no luck. The best way I learn is from seeing the code someplace and just playing with it for my own personal use.

jatar_k

5:50 am on May 8, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



well to do all of those things you may have to consider something a little more robust like php or perl, we can help with that too.

Perl and PHP CGI Scripting [webmasterworld.com]

I may be wrong but i think it will be much simpler, except for having to learn it. The things you want to do are fairly straight forward and not overly difficult to learn.

simple not too code intensive example using PHP
if you had a simple form with your fields
basic name, email, user id, password and confirm password

you could then post them to a "processing script"

the processing script could easily check if the passwords match

if ($password!= $confirm_password) {
echo "passwords dont match";
}

this is a simple if statement that says
if the value entered into the password field is not equal to the value entered into the confirm password field then echo (output to screen) "passwords dont match".

I dont know how much knowledge you have of programming or if you even want to learn any but these things can be accomplished with a little work.

If you are interested see www.php.net or just comeone over to the scripting forum. We're always up for new blood. :)

I also saw the code you posted originally but understood more from your short response than from that large code post, no offence intended by any means.