Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Validating form with Pure Asp UPload 2.0 2nd Post

1 view
Skip to first unread message

Shamy1

unread,
Feb 21, 2002, 1:12:50 PM2/21/02
to
How do I use a regular Ultradev validate form script with the Pure Asp
Upload 2.)? I validate a particular field, and the specifications arn't
met...then I do get the prompt that an error has occured...but after I push
ok, It automatically transfers to my "update complete" page.


Jon Parkhurst

unread,
Feb 21, 2002, 1:52:14 PM2/21/02
to
can you post the code you hvae?

--


Jon Parkhurst
Website Admin
*TMM Volunteer*
www.unimark.com

::: I don't intend to build in order to have clients, I intend to have
clients in order to build. :::
-Howard Roark, The Fountainhead

(clear the dust bunnies to reply)

"Shamy1" <esh...@hotmail.com> wrote in message
news:a53dg4$h1u$1...@forums.macromedia.com...
: How do I use a regular Ultradev validate form script with the Pure Asp

:
:


Dan Short - TMM

unread,
Feb 21, 2002, 2:02:49 PM2/21/02
to
Make sure that the validation is attached to the onSubmit even of the form,
and not the onClick action of the button. A URL would help though :)

--
:: Dan Short :: <- "Selection to Snippet" King
Team Macromedia DW Volunteer
http://www.macromedia.com/support/forums/team_macromedia
Web Design: http://www.web-shorts.com
Hosting: http://www.irapid.net
FAQ: http://www.dwfaq.com
Snippets Exchange: http://www.dwfaq.com/snippets/

Take out the witty remark to reply.

"Shamy1" <esh...@hotmail.com> wrote in message
news:a53dg4$h1u$1...@forums.macromedia.com...

Shamy1

unread,
Feb 21, 2002, 2:37:17 PM2/21/02
to
here is the page that works:

http://64.60.17.72/v2/page1.asp?up_id=92

why does this work and the other doesn't?

"Dan Short - TMM" <d...@wittyremark.web-shorts.com> wrote in message
news:a53g6n$n0m$1...@forums.macromedia.com...

Shamy1

unread,
Feb 21, 2002, 2:35:13 PM2/21/02
to
Ok guys...I just spent a while messing around with the script. When the UD
validate form script was above the Pure Asp Code on the behaviors panel, it
would redirect after the error was prompted. But if I moved the Pure Asp
validate script above the UD validate script, it seems to work fine.

But I still have the update problem. Now I know it's something I did
wrong...because I coded a page that only have three little field on it and
the update record with Pure Asp upload 2.0 (file not required) worked fine.
But on the link below, I get an error when you try and update the record.

the error is:

Microsoft VBScript runtime error '800a01a8'

Object required: 'UploadRequest.Item(...)'

/v2/ScriptLibrary/incPureUpload.asp, line 310


http://64.60.17.72/v2/Admin/employee/update.asp?ID=103

I know this page is a bit confusing...but what I have a resume upload page
(in an iframe) then the rest of the page as a regular update page. The emp
pic is using the Pure Asp Upload 2.0 script. If I leave it blank and go to
upload I get an error

If you don't want to week through this I understand!

Thanks a million!


"Dan Short - TMM" <d...@wittyremark.web-shorts.com> wrote in message
news:a53g6n$n0m$1...@forums.macromedia.com...

Jon Parkhurst

unread,
Feb 21, 2002, 2:56:34 PM2/21/02
to
Shamy-

;o) Can't see the asp code after it's been parsed by the server...

--


Jon Parkhurst
Website Admin
*TMM Volunteer*
www.unimark.com

::: I don't intend to build in order to have clients, I intend to have
clients in order to build. :::
-Howard Roark, The Fountainhead

(clear the dust bunnies to reply)

"Shamy1" <esh...@hotmail.com> wrote in message
news:a53jba$hp$1...@forums.macromedia.com...
: I just tried on another page..and I get the same error...here is another,
: smaller page to look at...
:
: http://64.60.17.72/v2/Admin/home/update1.asp?new_id=26
:
:
: "Dan Short - TMM" <d...@wittyremark.web-shorts.com> wrote in message
: news:a53g6n$n0m$1...@forums.macromedia.com...
: > Make sure that the validation is attached to the onSubmit even of the

: > >
: > >
: >
: >
:
:


Shamy1

unread,
Feb 21, 2002, 2:52:39 PM2/21/02
to
I just tried on another page..and I get the same error...here is another,
smaller page to look at...

http://64.60.17.72/v2/Admin/home/update1.asp?new_id=26


"Dan Short - TMM" <d...@wittyremark.web-shorts.com> wrote in message
news:a53g6n$n0m$1...@forums.macromedia.com...

Shamy1

unread,
Feb 21, 2002, 3:05:30 PM2/21/02
to
Here it is...I'll post the table were the file box is as well

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="../../Connections/PCIDB.asp" -->
<!--#include file="../../ScriptLibrary/incPureUpload.asp" -->
<%
'*** Pure ASP File
Upload -----------------------------------------------------
' Copyright (c) 2001 George Petrov, www.UDzone.com
' Process the upload
' Version: 2.0.7
'---------------------------------------------------------------------------
---
'*** File Upload to: """../../dn/news""", Extensions: "", Form: fmNews,
Redirect: "", "file", "", "over", "false", "", "" , "", "", "", "", "600",
"", "", ""

Dim GP_redirectPage, RequestBin, UploadQueryString, GP_uploadAction,
UploadRequest
PureUploadSetup

If (CStr(Request.QueryString("GP_upload")) <> "") Then
GP_redirectPage = ""
Server.ScriptTimeout = 600

RequestBin = Request.BinaryRead(Request.TotalBytes)
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin, """../../dn/news""", "file", "", "over"

If (GP_redirectPage <> "" and not (CStr(UploadFormRequest("MM_insert")) <>
"" or CStr(UploadFormRequest("MM_update")) <> "")) Then
If (InStr(1, GP_redirectPage, "?", vbTextCompare) = 0 And
UploadQueryString <> "") Then
GP_redirectPage = GP_redirectPage & "?" & UploadQueryString
End If
Response.Redirect(GP_redirectPage)
end if
else
if UploadQueryString <> "" then
UploadQueryString = UploadQueryString & "&GP_upload=true"
else
UploadQueryString = "GP_upload=true"
end if
end if
' End Pure Upload
'---------------------------------------------------------------------------
---
%>
<%
' *** Edit Operations: (Modified for File Upload) declare variables

MM_editAction = CStr(Request.ServerVariables("URL")) 'MM_editAction =
CStr(Request("URL"))
If (UploadQueryString <> "") Then
MM_editAction = MM_editAction & "?" & UploadQueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_update")) <> "" And
CStr(UploadFormRequest("MM_recordId")) <> "") Then

MM_editConnection = MM_PCIDB_STRING
MM_editTable = "dbo.news"
MM_editColumn = "new_id"
MM_recordId = "" + UploadFormRequest("MM_recordId") + ""
MM_editRedirectUrl = "successful.asp"
MM_fieldsStr =
"Title|value|txtText|value|rdOption|value|txtURL|value|cbPopup|value|txtPopM
es|value|txtfileruper|value|textfield|value|txtSort|value"
MM_columnsStr =
"title|',none,''|article|',none,''|type|none,none,NULL|url|',none,''|popup|n
one,1,0|particle|',none,''|fileup|',none,''|displaydate|',none,''|sortnum|',
none,''"

' create the MM_fields and MM_columns arrays
MM_columnsStr = FixColumnsForUpload(MM_fieldsStr,MM_columnsStr)
MM_fieldsStr = FixFieldsForUpload(MM_fieldsStr,MM_columnsStr)
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")

' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(UploadFormRequest(MM_fields(i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
UploadQueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If

End If
%>
<%
' *** Update Record: (Modified for File Upload) construct a sql update
statement and execute it

If (CStr(UploadFormRequest("MM_update")) <> "" And
CStr(UploadFormRequest("MM_recordId")) <> "") Then

' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(i) & " = " & FormVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " &
MM_recordId

If (Not MM_abortEdit) Then
' execute the update
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
set rssuth = Server.CreateObject("ADODB.Recordset")
rssuth.ActiveConnection = MM_PCIDB_STRING
rssuth.Source = "{call dbo.sp_Auth}"
rssuth.CursorType = 0
rssuth.CursorLocation = 2
rssuth.LockType = 3
rssuth.Open()
rssuth_numRows = 0
%>
<%
Dim rsnews__MMColParam
rsnews__MMColParam = "1"
if (Request.QueryString("new_id") <> "") then rsnews__MMColParam =
Request.QueryString("new_id")
%>
<%
set rsnews = Server.CreateObject("ADODB.Recordset")
rsnews.ActiveConnection = MM_PCIDB_STRING
rsnews.Source = "{call dbo.sp_news_update('" + Replace(rsnews__MMColParam,
"'", "''") + "')}"
rsnews.CursorType = 3
rsnews.CursorLocation = 3
rsnews.LockType = 3
rsnews.Open()
rsnews_numRows = 0
%>
<html>
<head>
<script language="JavaScript">
<!--

function
checkFileUpload(form,extensions,requireUpload,sizeLimit,minWidth,minHeight,m
axWidth,maxHeight,saveWidth,saveHeight) { //v2.0
document.MM_returnValue = true;
if (extensions != '') var re = new RegExp("\.(" +
extensions.replace(/,/gi,"|").replace(/s/gi,"") + ")$","i");
for (var i = 0; i<form.elements.length; i++) {
field = form.elements[i];
if (field.type.toUpperCase() != 'FILE') continue;
if (field.value == '') {
if (requireUpload) {alert('File is required!');document.MM_returnValue
= false;field.focus();break;}
} else {
if(extensions != '' && !re.test(field.value)) {
alert('This file type is not allowed for uploading.\nOnly the
following file extensions are allowed: ' + extensions + '.\nPlease select
another file and try again.');
document.MM_returnValue = false;field.focus();break;
}
document.PU_uploadForm = form;
re = new RegExp(".(gif|jpg|png|bmp|jpeg)$","i");
if(re.test(field.value) && (sizeLimit != '' || minWidth != '' ||
minHeight != '' || maxWidth != '' || maxHeight != '' || saveWidth != '' ||
saveHeight != '')) {

checkImageDimensions(field,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,s
aveWidth,saveHeight);
} } }
}

function showImageDimensions(fieldImg) { //v2.0
var isNS6 = (!document.all && document.getElementById ? true : false);
var img = (fieldImg && !isNS6 ? fieldImg : this);
if ((img.minWidth != '' && img.minWidth > img.width) || (img.minHeight !=
'' && img.minHeight > img.height)) {
alert('Uploaded Image is too small!\nShould be at least ' + img.minWidth
+ ' x ' + img.minHeight); return;}
if ((img.maxWidth != '' && img.width > img.maxWidth) || (img.maxHeight !=
'' && img.height > img.maxHeight)) {
alert('Uploaded Image is too big!\nShould be max ' + img.maxWidth + ' x
' + img.maxHeight); return;}
if (img.sizeLimit != '' && img.fileSize > img.sizeLimit) {
alert('Uploaded Image File Size is too big!\nShould be max ' +
(img.sizeLimit/1024) + ' KBytes'); return;}
if (img.saveWidth != '') document.PU_uploadForm[img.saveWidth].value =
img.width;
if (img.saveHeight != '') document.PU_uploadForm[img.saveHeight].value =
img.height;
document.MM_returnValue = true;
}

function checkImageDimensions(field,sizeL,minW,minH,maxW,maxH,saveW,saveH)
{ //v2.0
if (!document.layers) {
var isNS6 = (!document.all && document.getElementById ? true : false);
document.MM_returnValue = false; var imgURL = 'file:///' +
field.value.replace(/\\/gi,'/');
if (!field.gp_img || (field.gp_img && field.gp_img.src != imgURL) ||
isNS6) {field.gp_img = new Image();
with (field) {gp_img.sizeLimit = sizeL*1024; gp_img.minWidth = minW;
gp_img.minHeight = minH; gp_img.maxWidth = maxW; gp_img.maxHeight = maxH;
gp_img.saveWidth = saveW; gp_img.saveHeight = saveH; gp_img.onload =
showImageDimensions; gp_img.src = imgURL; }
} else showImageDimensions(field.gp_img);}
}
//-->
</script>


Dan Short - TMM

unread,
Feb 21, 2002, 3:12:37 PM2/21/02
to
Which line is line 310?

--
:: Dan Short :: <- "Selection to Snippet" King
Team Macromedia DW Volunteer
http://www.macromedia.com/support/forums/team_macromedia
Web Design: http://www.web-shorts.com
Hosting: http://www.irapid.net
FAQ: http://www.dwfaq.com
Snippets Exchange: http://www.dwfaq.com/snippets/

Take out the witty remark to reply.

"Shamy1" <esh...@hotmail.com> wrote in message

news:a53k3e$24a$3...@forums.macromedia.com...

Shamy1

unread,
Feb 21, 2002, 3:10:28 PM2/21/02
to
woops! sorry..here is a link the zip files. 'page1.asp' works but
'update1.asp' doesn't.

http://64.60.17.72/v2/files.zip

thanks!


"Jon Parkhurst" <admin@DUST_BUNNIESunimark.com> wrote in message
news:a53jd0$kc$1...@forums.macromedia.com...

Shamy1

unread,
Feb 21, 2002, 3:17:20 PM2/21/02
to
The error is happening on the include file that Pure Asp Upload generates.
here it is...

http://64.60.17.72/v2/includefile.ZIP

"Dan Short - TMM" <d...@wittyremark.web-shorts.com> wrote in message

news:a53k9k$2ia$1...@forums.macromedia.com...

Dan Short - TMM

unread,
Feb 21, 2002, 3:31:04 PM2/21/02
to
My guess is this is the line that's causing the problem:

GP_CurFileName = UploadRequest.Item(GP_FieldName).Item("FileName")

You don't have a field named "FileName". Try changing your upload filed name
to either FileName or changing that line in the script to show the correct
field name for "FileName".

Like I said, that's a guess. Line 310 (which is generating your error) is
just a comment line in the file you sent me, so I'm not positive where the
problem really is.

--
:: Dan Short :: <- "Selection to Snippet" King
Team Macromedia DW Volunteer
http://www.macromedia.com/support/forums/team_macromedia
Web Design: http://www.web-shorts.com
Hosting: http://www.irapid.net
FAQ: http://www.dwfaq.com
Snippets Exchange: http://www.dwfaq.com/snippets/

Take out the witty remark to reply.

"Shamy1" <esh...@hotmail.com> wrote in message

news:a53kpj$3ls$1...@forums.macromedia.com...

Dan Short - TMM

unread,
Feb 21, 2002, 3:31:52 PM2/21/02
to
Also, you might have better luck with this particular extension at the
newsgroups on http://www.udzone.com, as George usually hangs out there
answering questions about his extensions.

--
:: Dan Short :: <- "Selection to Snippet" King
Team Macromedia DW Volunteer
http://www.macromedia.com/support/forums/team_macromedia
Web Design: http://www.web-shorts.com
Hosting: http://www.irapid.net
FAQ: http://www.dwfaq.com
Snippets Exchange: http://www.dwfaq.com/snippets/

Take out the witty remark to reply.

"Shamy1" <esh...@hotmail.com> wrote in message

news:a53kpj$3ls$1...@forums.macromedia.com...

Dan Short - TMM

unread,
Feb 21, 2002, 3:18:13 PM2/21/02
to
Which line are you getting the error on? Line 310 is just a plain <table>
tag.

--
:: Dan Short :: <- "Selection to Snippet" King
Team Macromedia DW Volunteer
http://www.macromedia.com/support/forums/team_macromedia
Web Design: http://www.web-shorts.com
Hosting: http://www.irapid.net
FAQ: http://www.dwfaq.com
Snippets Exchange: http://www.dwfaq.com/snippets/

Take out the witty remark to reply.

"Shamy1" <esh...@hotmail.com> wrote in message

news:a53kco$2o7$3...@forums.macromedia.com...

Shamy1

unread,
Feb 21, 2002, 3:39:51 PM2/21/02
to
hmm, ya, I think your right about the error line..., But, I think
"FileName" is a variable. After all, this include file is linked to from
many pages. So I can't change it. The vaiable is defined on that include
file. I looked through the script and it is requesting the file field
name, which is defined on the live page. I'm not very familiar with what
going on in the include file....not that good with asp.

I posted this question at UDZone but havn't got any request yet....I don't
understand why it works on one page but not he other....Everypage where I
have a lot of scripting, I get the same error

"Dan Short - TMM" <d...@wittyremark.web-shorts.com> wrote in message

news:a53lc7$4t9$1...@forums.macromedia.com...

Dan Short - TMM

unread,
Feb 21, 2002, 3:45:40 PM2/21/02
to
And it always works if you do upload a file correct?

--
:: Dan Short :: <- "Selection to Snippet" King
Team Macromedia DW Volunteer
http://www.macromedia.com/support/forums/team_macromedia
Web Design: http://www.web-shorts.com
Hosting: http://www.irapid.net
FAQ: http://www.dwfaq.com
Snippets Exchange: http://www.dwfaq.com/snippets/

Take out the witty remark to reply.

"Shamy1" <esh...@hotmail.com> wrote in message

news:a53m3r$6cp$1...@forums.macromedia.com...

0 new messages