•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 456,607 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,492 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting
Views: 3422 | Replies: 20 | Solved
![]() |
•
•
Join Date: Aug 2007
Posts: 76
Reputation:
Rep Power: 2
Solved Threads: 4
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
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>•
•
Join Date: Sep 2007
Posts: 1,058
Reputation:
Rep Power: 4
Solved Threads: 61
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.
•
•
Join Date: Aug 2007
Posts: 76
Reputation:
Rep Power: 2
Solved Threads: 4
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............
•
•
Join Date: Aug 2007
Posts: 76
Reputation:
Rep Power: 2
Solved Threads: 4
<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
•
•
Join Date: Sep 2007
Posts: 1,058
Reputation:
Rep Power: 4
Solved Threads: 61
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:
Now on your next page, just do the following:
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="" />
Session("imgcap" & strSUnique) = request.form("sessionvalue")•
•
Join Date: Aug 2007
Posts: 76
Reputation:
Rep Power: 2
Solved Threads: 4
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..
i will give u the complete form and the next page requirements also..
this is my form in one page and the continuing is next page..
i think my hidden field not taking the value............
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">
<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............
![]() |
•
•
•
•
•
•
•
•
DaniWeb ASP Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Checkbox has no properties in FireFox. Works fine in IE (JavaScript / DHTML / AJAX)
- email, zipcode, and password confirm problem (JavaScript / DHTML / AJAX)
- Wireless Mouse Issue (Peripherals)
- hid mouse with 7 buttons (Software Developers' Lounge)
- handling extra mouse buttons? (Techies' Lounge)
- How do I Click the Command Buttons In other Executable Programs (Visual Basic 4 / 5 / 6)
- Fully Customize your desktop (Windows NT / 2000 / XP / 2003)
- Unable To Click Buttons (Web Browsers)
Other Threads in the ASP Forum
- Previous Thread: help me please. i am making a login page..
- Next Thread: SQl Injection through ASP and MS SQl 2000



Linear Mode