Form Submission Question

J

Jeremy

Hi All,
I'm trying to create a client-side event that will run when the user
submits a form. I want them to be able to enter a value for USERID
that will either be "(e-mail address removed)" or just "joe."

If the value is just "joe" don't do anything to it, and if the value is
"(e-mail address removed)", strip the "@domain.com" before submitting it.

Here's something that I thought might work, but didn't. Any guru that
could whip something up would be really appreciated. Thanks in
advance!

<SCRIPT TYPE="text/javascript">
<!--
// This will remove the '@domain.com' before submitting the form.
//
function WackTheDomain()
{
if ( (USERID contains "@domain.com") )
returnval = USERID -"domain.com";
else
returnval = USERID;
}
// -->
</SCRIPT>


<FORM NAME="LOGIN" AUTOCOMPLETE="OFF" METHOD="POST"
ACTION="https://someURL.com" onSubmit="return WackTheDomain()">

User Name <INPUT TYPE="TEXT" id ="USERID" NAME ="USERID"
VALUE=""><p>&nbsp;</p>
Password <INPUT TYPE="PASSWORD" id ="PASSWORD" NAME ="PASSWORD"
VALUE="">
<p>&nbsp;</p>
<p>

<INPUT TYPE="SUBMIT" id ="SUBMIT" NAME ="SUBMIT" alt = "Submit The
Form" >
<INPUT TYPE="HIDDEN" id ="ACTION" NAME ="ACTION" VALUE="LOGIN">

</p>


</FORM>
 
H

hywel.jenkins

Jeremy said:
Hi All,
I'm trying to create a client-side event that will run when the user
submits a form. I want them to be able to enter a value for USERID
that will either be "(e-mail address removed)" or just "joe."

If the value is just "joe" don't do anything to it, and if the value is
"(e-mail address removed)", strip the "@domain.com" before submitting it.

Here's something that I thought might work, but didn't.

That's because your code isn't JavaScript. If that's supposed to be a
pseudo-code representation of your realy code, it's useless. Post the
real code.

If you're submitting to a server-side process do the interpretation
server-side, too.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,139
Latest member
JamaalCald
Top