Hi to all

am new to asp and am parcipating a project on asp in our company... here i got one prob that passing the parameter thru onclick.. i tried a lot but nothing materialize..

i have 5 buttons here.. for all buttons same function that i have to submit the form iprev.. here my prob is when i save parameter into a session variable its showing "type mismatch" when i call the function.. here i given my codes and function nooooo sub.. plz if u can guide me plzzzzzz

<input type="button" value="Upload" name="B1" onClick='uploadpicture("img1")'><br><br>
<input type="button" value="Upload" name="B2" onClick='uploadpicture("img2")'><br><br>
<input type="button" value="Upload" name="B3" onClick='uploadpicture("img3")'><br><br>
<input type="button" value="Upload" name="B4" onClick='uploadpicture("img4")'><br><br>
<input type="button" value="Upload" name="B5" onClick='uploadpicture("img5")'><br><br>

<script language="vbscript">
Sub uploadpicture(imgno)
Session("imagecap" & strSUnique) = imgno
Document.iprev.submit()
End Sub
</script>

no am getting the value of imgno inside the function...
after that i cannot assign it to a session variable..
if its not possible is thr any other ways to pass the parameters.....(other than url querystring)

Then your session variable is not setting correctly. You should have no problem retrieving and setting that imgno. The problem happens when you set the name of the session variable. Do you have to have a unique string on it as each session is only used by one computer? Try removing the strSUnique OR try resetting the value of strSUnique inside your sub. I know by removing it, it will work. It may work if you redeclare the variable in your sub.

but its showing session is not a keyword when i put it inside the sub or function which is inside the vbscript. but outside the vbscript its working.. and another thing after removing vbscript tag when i click the button it should call the function but its showing object expected which is that function... think i am totally confused............

<input type="button" value="Upload" name="B1" onclick='<% Session("imagecap" & strSUnique) = "1"%>;submit()'><br><br>
<input type="button" value="Upload" name="B2" onclick='<% Session("imagecap" & strSUnique) = "2"%>;submit()'><br><br>
<input type="button" value="Upload" name="B3" onclick='<% Session("imagecap" & strSUnique) = "3"%>;submit()'><br><br>
<input type="button" value="Upload" name="B4" onclick='<% Session("imagecap" & strSUnique) = "4"%>;submit()'><br><br>
<input type="button" value="Upload" name="B5" onclick='<% Session("imagecap" & strSUnique) = "5"%>;submit()'><br><br>

now i tried like this.. working but whatever button i clicked its returning the value "5" for session variable.. cannot understand... can u plzzzzz if u found any prob here plzzzzz let me know.. coz i already taken 3 days for this........ plzzzzzzzz

the reason why your last code isn't working like you thought is because you are calling the <% %> when the server runs the code. Therefore, you are essentially setting session("imagecap...) 5 times, with firs 1, then 2, then 3, and ending in 5. This is why it will always be 5. Sorry I missed this before, but vbscript does not set values without the "SET" before the word.

set Session("imagecap" & strSUnique) = "#"

Unfortunatley I don't believe this will work because vbscript does not work with sessions this way. Your only way to make it work is to put it all in a form and send it back to itself, or to the next page with hidden input fields. Do something like this below:

<input type="button" value="Upload" name="B1" onclick="this.form.sessionvalue.value='1';submit()"><br><br>
<input type="button" value="Upload" name="B2" onclick="this.form.sessionvalue.value='1';submit()"><br><br>
<input type="button" value="Upload" name="B3" onclick="this.form.sessionvalue.value='1';submit()"><br><br>
<input type="button" value="Upload" name="B4" onclick"this.form.sessionvalue.value='1';submit()"><br><br>
<input type="button" value="Upload" name="B5" onclick="this.form.sessionvalue.value='1';submit()" /><br><br><input type="hidden" id="sessionvalue" name="sessionvalue" value="" />

Now on your next page, just do the following:

Session("imgcap" & strSUnique) = request.form("sessionvalue")
Comments
spectacular idea whn i was thinkless... thank you very much

hei this is some good logic but not working..
here my hidden field doesnot accept the value i think..
i forgot to say another thing .. my form tag is..

<form enctype="multipart/form-data" action="admin_iupl.asp" method="post" name="iprev">

i will give u the complete form and the next page requirements also..

<form enctype="multipart/form-data" action="admin_iupl.asp" method="post" name="iprev">

<table>
<div>

<th align="Right" width="20%" valign="top">

Caption Image<br>

<%If uploadpic then
If Not uPA(0) = Empty then%>
<img id="img1" height="100" width="100" src=<%=upload & uPA(0)%>><br><br>
<%else%>
<img id="img1" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if
else%>
<img id="img1" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if%>

<%If uploadpic then
If Not uPA(1) = Empty Then%>
<img id="img2" height="100" width="100" src=<%=upload & uPA(1)%>><br><br>
<%Else%>
<img id="img2" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if
else%>
<img id="img2" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if%>

<%If uploadpic then
If Not uPA(2) = Empty Then%>
<img id="img3" height="100" width="100" src=<%=upload & uPA(2)%>><br><br>
<%else%>
<img id="img3" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if
else%>
<img id="img3" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if%>

<%If uploadpic Then
If Not uPA(3) = Empty Then%>
<img id="img4" height="100" width="100" src=<%=upload & uPA(3)%>><br><br>
<%else%>
<img id="img4" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if
else%>
<img id="img4" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if%>

<%If uploadpic then
If Not uPA(4) = Empty Then%>
<img id="img5" height="100" width="100" src=<%=upload & uPA(4)%>>
<%else%>
<img id="img5" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if
else%>
<img id="img5" height="100" width="100" src="img/nopic.gif"><br><br>
<%end if%>

</th>
<th align="Left" width="80%" valign="top">

<br>

<textarea rows="4" cols="35" name="img1caption">Ad Description</textarea><br>
<input name="selpic" type="file" id="imgbrowse1">
<input type="button" value="Upload" name="B1" id="B1" onclick="this.form.sessionvalue.value='0';submit()"><br><br><br>

<textarea rows="4" cols="35" name="img2caption">Ad Or Image Description</textarea><br>
<input name="selpic" type="file">
<input type="button" value="Upload" name="B2" id="B2" onclick="this.form.sessionvalue.value='1';submit()"><br><br>

<textarea rows="4" cols="35" name="img3caption">Image Description</textarea><br>
<input name="selpic" type="file">
<input type="button" value="Upload" name="B3" id="B3" onclick="this.form.sessionvalue.value='2';submit()"><br><br>


<textarea rows="4" cols="35" name="img4caption">Image Description</textarea><br>
<input name="selpic" type="file">
<input type="button" value="Upload" name="B4" id="B4" onclick="this.form.sessionvalue.value='3';submit()"><br><br><br>


<textarea rows="4" cols="35" name="img5caption">Image Description</textarea><br>
<input name="selpic" type="file">
<input type="button" value="Upload" name="B5" id="B5" onclick="this.form.sessionvalue.value='4';submit()"><br><br>

<input type="hidden" id="sessionvalue" name="sessionvalue" value="">
</th>
</table>
</form>

this is my form in one page and the continuing is next page..

Session("imgcap" & strSUnique) = request.form("sessionvalue")

i think my hidden field not taking the value............

another one thing....another form is here in this same page.. i forgot to tell this.. sorryyyyyyyyyyyy

did you try changing "this.form..." to "document.iprev.sessionvalue.value=" or "document.forms.iprev.sessionvalue.value="?
Get back to me, I'll help you figure this one out tonight.

hei now the hidden value is ok its retrieving correct values from 0 to 4.. its by using the this.for... only...
now the prob with request.form in the next page
whn i go thru searches i think i have to use the binary read but this binary read i dont know how to use

n = Request.TotalBytes
data = Request.BinaryRead(n)
For i = 1 to n
Response.Write MidB( data, i, 1 )
Next

this is the binary read

it works but how can i get the value for sessionvalue..

another one option is thr which is using "upload.form("sessionvalue")" when i try this its showing error with the upload folder name that object required.......
am getting some ideas but i dont have luck at all...
am still trying....

why you use upload.form? Not sure why you're doing that and not using request.form. To request the value of the hidden input field, use request.form("sessionvalue") and set it to a string

Dim strHidden = Request.Form("sessionvalue")

hei here we cannot use the request.form coz the form already assigned as enctype="multipart/form-data" so by request.form we cannot get the value....here...

if i remove the multipart/form then its working corectly but i have to upload.... but the upload is not working...... for uploading we are force to do the multipart.. i dont know wht am going to do.. my other works also pending... only two days left to finish all my works.. thank you for ur ideas.. plz if u find something get me at yahoo chat..my id anto_nee@yahoo.co.in... plz

oh yeah. That's right. You are specifying two separate data types on the form. Okay, then try this.

n = Request.TotalBytes
data = Request.BinaryRead(n)
For i = 1 to n
Response.Write MidB( data, i, 1 )
Next

dim form = Server.CreateObject("MyRequest.Form")
form.Init()
Session("sessionvalue") = form("sessionvalue")

expected end od statement its showing in the line dim form..

whn i change.. 'set' instead of 'dim' its showing invalid classstring...

hmm.. still prob..

I do not have yahoo, actually I do not use any instant messengers! Sorry, yeah forgot about that "set" thing. Before you put this inside a vbscript tag, set your session variable. I haven't done asp in a year now, so I am a bit rusty. I would highly suggest coming to asp.net, but that's all up to you. Anyway, I think we are heading into an empty hole. Unless.. why do you need the session variable anyway? If this is how you want it, you can do a simple work around. Upload the file first, then after it uploads, createa form to send via post and set the value to the variable you set to equal the hidden input. Then automatically submit that form to the next page wher eyou can request it via request.form.

<%
n = Request.TotalBytes
data = Request.BinaryRead(n)
For i = 1 to n
Response.Write MidB( data, i, 1 )
Next

dim form = Server.CreateObject("MyRequest.Form")
form.Init()
Dim strHidden = form("sessionvalue")
'or use the set.. whatever works.
%>
<body onload="document.auto.submit()">
<%
response.write ("<form name=""auto"" id=""auto"" action=""newfile.asp"" method=""post"">" & vbCrLf)
response.write ("<input type=""hidden"" name=""sessionvalue"" id=""sessionvalue"" value=""" & strHidden & """ />" & vbCrLf)
response.write ("</form>")
%>
</body>

Then on your next page, just "Session("imgcap" & strSUnique) = Request.Form("sessionvalue")"

hei................SheSaidImaPregy..

thank you very much for ur support..

i find a way to solve it

Set UploadImg = New FreeASPUpload
	UploadImg.Save uploadPath, false, 10000000
	L = UploadImg.form("sessionvalue")

this is working properly

the next problem already started..

this is simple thing with array

i will try to solve it

once again thank you

I have no problem helping others. always helps me find better solutions for my problems later on. Glad to see you moved on to a free upload? :)

This question has already been answered. Start a new discussion instead.