Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Null form value--Weird problem

Status
Not open for further replies.

snix1

Programmer
Dec 12, 2000
107
US
Hi! I have a form that a user fills out to send an email message. It requests the usual stuff: Sender's Name, Sender's Email address, Recipient Name, Recipient Email address, message. After they hit SUBMIT, the action displays what they've entered after doing some error checking to make sure all required fields are entered. Most of the time, it works fine. The client has reported and shown me screen shots of what happens sometimes. The script reports the Sender's Name is missing as an error. BUT IT'S THERE! Does anyone have any ideas of what could be wrong. Here are some code snippets:

Code:
<form action="admin/sendDistribution2_test.asp" ENCTYPE="multipart/form-data" method="post">
	<tr>
		<td class="fontbold" align="left">[COLOR=#ff0000]Sender's Name:[/color]</td>
	</tr>
	<tr>	
		<td class="font1">
		<input class="font1" type="text" name="txtName" size="50">
		</td>
	</tr>
	<tr>
		<td class="fontbold" align="left">Sender's Email:</td>
	</tr>
	<tr>	
		<td class="font1">
		<input class="font1" type="text" name="txtEmail" size="50">
		</td>
	</tr>
	<tr>
		<td class="font1">&nbsp;</td>
	</tr>
	<tr>
		<td class="fontbold" align="left">Message Subject:</td>
	</tr>
	<tr>	
		<td class="font1">
		<input class="font1" type="text" name="txtSubject" size="70">
		</td>
	</tr>	
	<tr>
		<td class="fontbold" align="left">Message:</td>
	</tr>
	<tr>
		<td class="font1">
		<textarea name="txtAreaMessage" class="font1" cols="85" rows="15"></textarea>
		</td>
	</tr>
	<tr>
		<td class="font1">&nbsp;</td>
	</tr>
	<tr>
		<td class="fontbold" align="left">Attachments:</td>
	</tr>
	<tr>	
		<td class="font1">
		<input class="font1" type="file" name="file1" size="70"><br>
		<input class="font1" type="file" name="file2" size="70"><br>
		<input class="font1" type="file" name="file3" size="70">
		</td>
	</tr>
etc.

The action is here:

Code:
[COLOR=#ff0000]strName = Trim(objUpload.Form("txtName"))[/color]
strEmail = Trim(objUpload.Form("txtEmail"))
strSubject = Trim(objUpload.Form("txtSubject"))
strMessage = Trim(objUpload.Form("txtAreaMessage"))

'FLAG CHECKING IF REQUIRED FIELD ARE FILLED
blnContinue = true
strErrorMessage = ""

'CHECK FOR REQUIRED FIELDS
if (strName = "") then
	strErrorMessage = strErrorMessage & "<li>Sender's Name"
	blnContinue = false
end if

if (strEmail = "") then
	strErrorMessage = strErrorMessage & "<li>Sender's Email Address"
	blnContinue = false
end if

if (strSubject = "") then
	strErrorMessage = strErrorMessage & "<li>Message Subject"
	blnContinue = false
end if

if (strMessage = "") then
	strErrorMessage = strErrorMessage & "<li>Message"
	blnContinue = false
end if
'CHECKS REQUIRED FIELDS
if not(blnContinue) then
%>
<span class="warning">
The following criteria must be entered.
</span>
<span class="font1">
<ul>
<%=strErrorMessage%>
</ul>
Please push the back button on your browser and try again.
</font>

Thanks!

 
perhaps try changing objupload to request? that way you have request.form("txtname")
 
Thanks, DreXor, but because they can upload a file to attach to the email, I must use that. The product is Persits and uses this:
Set objUpload = Server.CreateObject("Persits.Upload")

Needed because of the file upload.
 
Have you been able to duplicate this yourself? Does it matter whether a file has been attached or not? Is there any method to loop through the form values in the objUpload? If you can duplicate the error have you attempted to loop through the form values to see if maybe the name (key) has been changed forany of the inputs (or if, instead, the value is imply getting lost somehow)?

-T

[sub]01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111[/sub]
The never-completed website:
 
Thanks, Tarwn. I am working on that now and no, no file is being uploaded. The problem I have is that I can't reproduce it; seems to work fine for me and only fail for the client occaisionally. That's the rub!! Thanks for your input, though.
 
i use SAFileUp, from software artisans... this might be a long shot here, but in their file upload object, you cannot use request.form(value) at ALL if there's a file attachment, all things in the form must be referenced via uploadobject.formex(value) and so on (which it looks like you're doing) BUT you didnt show the object creation in the action code supplied, verify under the "certain" conditions that may apply you're not requesting anything from the form outside of the methods of your upload object. it may be bombing itself out.

also perchance are you using load balancing? i've had instances in the past where mirroring didn't work perfectly and there were slight differences in the files ( forms / actions ) that would cause complications.
 
Yes, I've used Safileup, too. I think persits is similar in that you must use the upload object to refer to all form variables. I will doublecheck to make sure that's what is being done. Thanks for your info. And we are not using mirroring or anything like that, thank heaven!

Thanks so much!
 
no problem, i'll keep an eye on this thread and do what i can to try and help
 
Just a quick update for this thread. I got the bright idea, since I could not reproduce this, that it might be a "cache" problem. I had the client clear the cache and then she was able to get it to work!!! BUT, just this moring, she says the problem is back and is persistent even after she cleared the cache! So I'm back to square one, it seems. Thanks for any help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top