Form Field validation

W

Wintensive

Is there a way to setup forms so that certain fields must be completed
before the form will allow a submission? Right now I have a form that
will submit even if there is no data at all in any of the fields.
Also, can the form check that an email field at least has an email in
it. I know it can't verify that it is a real email, just that it is in
the correct format.

Thanks in advance to everyone here!
 
W

Wintensive

Umm...OK. So there is NO form control of the type I mentioned. The
article was pretty clear and simple about that.
 
S

Sarah0824

If you are familiar with js or html there may be some code out there you can
use in an HTML code fragment. Just google form field validation code or
something along those lines.
 
D

DavidF

You read the article correctly. But I hope you also noted that you can
integrate the form controls with other form programs. Check with your host
provider to see what form program they provide, and see if that one has the
validation features you desire.

DavidF
 
W

Wintensive

I've looked on the internet and I see some examples, but the simple
fact is that I have no idea how to use javascript. I really only have
the most basic understanding of html code as well. So I can't take
the examples I see and create usable code based on my form. If anyone
knows of a complete step by step guide for this, one written for
complete newbs, that might assist me. I'm more than a little
embarrased that I couldn't even take the very examples I saw and
figure out how to template them into something for my form, but oh
well.

Again, any pointers would be greatly appreciated!
 
W

Wintensive

I use godaddy. They use gdform.asp. I am using that currently to
submit the forms. I see examples of validation code, but I don't know
which words to replace with the proper field for my form. The sad
fact is that I need a tutorial for someone who has no working
knowledge of javascript. I guess it's kind of silly for me to ask for
javascript code solutions to my problem when I can't use javascript.
It looks like something I could learn how to do, at least for this
simple problem, but Im not sure how to transform the example code into
something that works with my exact form and form fields.

Thanks for all the suggestions though...I appreciate that!
 
D

DavidF

One of the reasons to use Publisher to produce web pages is to avoid having
to learn html coding or javascript. With that convenience comes tradeoffs.
One of them is if you use a Publisher built form, then you cannot force
field validation. If you want to take it to another level, then you need to
invest the time in learning what you need to know to get other form programs
to work. Sorry, but we can't do that for you. Sometimes it is a lot of trial
and terror... Forms can be tough to figure out, so don't feel bad if you
can't get them to work right away.

I am not familiar with gdform.asp, and it sounds like you are using that
instead of a Publisher built form that relies on FPSE to function. In which
case, none of this conversation is relevant anyway, because we assumed you
were talking about a Publisher built FPSE form. If you choose to use
gdform.asp then you will need to go to the GoDaddy site and read the
instructions. I also googled "gdform.asp" and came up with 2,800 hits. I
would suggest that you look through those to get answers. Also, doesn't
GoDaddy have a forum for users? Perhaps post your question there.

Alternatively live with the fact that the form you have does not do
everything you want. Keep it simple. If the people that are using your form
actually want a response from you, then they will fill out the form
correctly. Add some verbiage that tells them that all the fields are
optional, but if they don't fill them out correctly that you won't be
responding. Give them an email address too...or even just an email link, so
they can follow up with that, or just use email in the first place. The
people that are trying to fill out your form may know less than you, so keep
it simple for them.

As per javasript code snippets, it depends upon what you are doing, but you
can insert code into your Publisher pages by using the Insert html code
fragment feature. Most of the javascript code snippet that I have found and
used just require changing out the URLs, and/or other things that are
specific to your site. More trial and terror I am afraid. Welcome to web
design...it ain't for the timid ;-)

DavidF
 
M

Mike Koewler

Here's a sample of a form that includes validating that the field is
filled in with text:
This part goes in the <head></head> part. 'edit_1' is the name of the field:
<script type="text/javascript">
function validate_form_1( form )
{
//Custom Validation Steps
if( form.elements['edit_1'].value=="" ) { alert("Please enter your
name"); form.elements['edit_1'].focus(); return false; }
//Custom Validation for element
//Custom Validation Steps
return true;
}
</script>

This part goes in the body:
<form id="form_1" onsubmit="return validate_form_1(this)"
action="http://www.yourdomain.com/formname.extension" method="post"
target="_self" enctype="multipart/form-data" accept-charset="UTF-8"
style="margin:0px;>

(The 'formname.extension' would be whatever program you are using to
handle the form data.)

And the field for the form looks something like this:
<input type="text" id="edit_1" name="edit_1" size="4" width="50px;>

Notice the id="edit_1" which is what the javascript is referring to.

If you want an e-mail validation, this goes into the <head></head> part:
if(!ValidateEmail(form.elements['e-mail'].value)) { alert("Please enter
your e-mail address"); form.elements['e-mail'].focus(); return false; }

(In this case, the form field is called 'e-mail'.

HTH,

Mike

(BTW, I just did a form using WP's form wizard and copied/pasted the
source code. I know nothing about javascript!
 

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

Top