cgi-req'd fields-instead of js

liunx

Guest
help!
we have a script that we are using for a "page me" form. we would like to have the fields "required"
right now - if someone fills out the form completely it processes just fine.
if they don't fill out a field it get's an error (an Internal Server Error).
my techie (my husband) said that I need to put in the js for requiring the fields - but i'm having trouble getting that to work.
another wrench is the js validation stuff (which worked on a different form) is somehow tied to FP & i think it would be more efficient to just incorporate it into the cgi script
ALSO - the form is in a popup w/out a back button so initially i had decided to just do away w/ validation cuz ppl wouldn't be able to use their back button to go back to the form.
this just seems to be getting more & more complicated!
anyone have a few lines of script (that would help) that they'd like to throw at me?
tia,
shelly (who wishes she had time & money to take a class in cgi, perl & js!)

if it helps - go this page - URL REMOVED & then click on Instant E-MailHmmm....does the email actually get delivered if all the fields are filled in?

If I go directly to the URL of the pageme.pl script, bypassing your form completely, I get a 500 Internal Error message.

And it looks like your form validation code is not matched with the form?

The input fields in the form are:

username
phoneno
subject

but the FP validation code is not checking those fields.

I'm not real good with JS but try using this edited section of code in place of the exisiting code:


<!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --><script Language="JavaScript"><!--
function FrontPage_Form1_Validator(theForm)
{

if (theForm.username.value == "")
{
alert("Please enter a value for the \"name\" field.");
theForm.username.focus();
return (false);
}

if (theForm.phoneno.value.length == "")
{
alert("Please enter a phone number in the \"phone number\" field.");
theForm.phoneno.focus();
return (false);
}

if (theForm.subject.value == "")
{
alert("Please enter a short message in the \"subject\" field.");
theForm.subject.focus();
return (false);
}
return (true);
}
//--></script><!--webbot BOT="GeneratedScript" endspan -->


If that doesn't work maybe someone else will know something.

Regards,
Kevinthanks kevin - that really helped me w/ another form that wasn't working! :)
i think i might still be missing something because the pager one still isn't working - i'm going to continue going over it w/ a fine toothed comb to see what i'm missing
btw - i feel like such an airhead for not catching that before! thanks!
btw - the form that is now working uses a different perl script so I'm not looking at that.The form seems to work if the name field is left blank (the thank you message displays). If the name field is filled in the script bombs (500 error). I would start checking in that area of the script that processes the name field.

The script also bombs if accessed directly from the URL <!-- m --><a class="postlink" href="http://misterhomes.com/cgi-bin/pageme.pl">http://misterhomes.com/cgi-bin/pageme.pl</a><!-- m -->

Make sure you have setup the pl script correctly.

BTW, I see you are checking the form for blank entries (=="")and for entries that contain less than one character, (<1), doesn't seem necessary to check for both of those states, but its your form :)

Regards,
Kevinif you fill in all fields (including name) the form does work (thank you screen appears)
i have checked the script & the code & cannot find anything apparent.
my confusion is that everything seemed to work BEFORE i put in the validation js. i will remove all the validation js & see what happens.

------

OK! back to square one! it's definately the perl script because i went back to the original page my techie wrote (--URL REMOVED-- ) & got the same results when i didn't fill in the form! will post later how HE fixes it! :)
BTW - he was testing this in netscape & didn't have a prob - so maybe it's an IE thing?
---
UPDATE!! - it IS an IE thing! He was not getting any of the same probs w/ Netscape - and it's not the perl - it's the js! He is now working on the problem to see if he can figure out why line 68 character 5 of the file doesn't seem to want to work! thank gawd for techies. btw - the page w/ the js can now be found at --URL REMOVED-- & please stop paging me! LOL
---
UPDATE AGAIN!! - it was a javascript error that was causing the validation scripts not to work (my hacking was bad) & as for the other (internal) error - as it was explained to me - the reason it will go to the thank you screen when some of the fields are filled in but not when none are filled in has to do w/ certain fields being required for the perl script to work - so apparently the name field is not req'd for the script to work but the others are - or something like that! so i guess it was a js problem after all! thank you-thank you for all your help!
 
Back
Top