...

View Full Version : Buttons.. Pls help...



twocool
04-11-2003, 08:34 AM
I got this code.... it only runs when i put in these buttons

<form method="post" action="display_form.asp" target="_blank">
<input type="hidden" name="vReqNo" value="<%=ReqNo%>">
<input type="hidden" name="vAppnId" value="<%=vAppnId%>">
<input type="hidden" name="vreqTitle" value="<%=vreqTitle%>">
<input type="hidden" name="vDesiredDt" value="<%=vDesiredDt%>">
<input type="hidden" name="vReqtr" value="<%=vReqtr%>">
<!--input type="hidden" name="vdate" value="<%=date()%>"-->
<input type="hidden" name="vContactNo" value="<%=vContactNo%>">
<input type="hidden" name="vDept" value="<%=vDept%>">
<input type="hidden" name="vRC" value="<%=vRC%>">
<input type="hidden" name="vPriority" value="<%=vPriority%>">
<input type="hidden" name="vfuncReq" value="<%=vfuncReq%>">
<input type="hidden" name="vFreqVol" value="<%=vFreqVol%>">
<input type="hidden" name="vSavings" value="<%=vSavings%>">
<input type="hidden" name="vRevenue" value="<%=vRevenue%>">
<input type="hidden" name="vBenefit" value="<%=vBenefit%>">
<input type="hidden" name="vTester" value="<%=vTester%>">
<input type="hidden" name="vTesterContact" value="<%=vTesterContact%>">
<input type="hidden" name="vApprovOfficer" value="<%=vApprovOfficer%>">
<input type="hidden" name="vApprovEmail" value="<%=vApprovEmail%>">
<input type="submit" name="submit" value="View Form">
</form>
<form method="post" action="../mainframe.asp">
<input type="submit" name="submit" value="Close">
</form>

BUT IF I REPLACE IT WITH A FLASH BUTTON... how can the code be working... pls.. help me.. need yr advise
:(

david7777
04-11-2003, 09:33 AM
You will need to use a bit of javascript.

First of all - you need to name your forms.


<form name="myForm" method="post" action="display_form.asp" target="_blank">

Then, as the link on the flash button, you must put


javascript:window.document.myForm.submit()

(No space in javascript - the forum seems to put the space there automatically)
This will then submit the form as if you have pressed the original submit button.

Do the same with the other form.
:cool:

twocool
04-11-2003, 10:07 AM
btw the flash button i took is from the dreamweaver...
then how should i put the link




javascript:window.document.myForm.submit()

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="105" height="23">
<param name="BASE" value=".">
<param name=movie value="view.swf">
<param name=quality value=high>
<param name="BGCOLOR" value="#FFFFCC">
<embed src="view.swf" base="." quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" bgcolor="#FFFFCC">
</embed>
</object>

in where i should put the link... pls help me. i not sure

david7777
04-12-2003, 12:19 PM
You need to re-create the flash button in dreamweaver. When you say "insert flash button", a settings box appears where you need to put the javascript in the link text box. The link wont be in the code, because it is saved by dreamweaver in the flash file.

twocool
04-14-2003, 01:56 AM
Sorry..... i put the link the text box.. then run the website..
i clock on the button nothing pops up or wat........

<form name="myForm" method="post" action="display_form.asp" target="_blank">

i done this

then put the javascript:window.document.myForm.submit()

on the link all those

cant seem to work..... :(

david7777
04-14-2003, 07:56 AM
Try both of these:


<form>
... Form elements ...
</form>
<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="105" height="23">
<param name="BASE" value=".">
<param name=movie value="view.swf">
<param name=quality value=high>
<param name="BGCOLOR" value="#FFFFCC">
<embed src="view.swf" base="." quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" bgcolor="#FFFFCC">
</embed>
</object>


or:


<form>
... Form elements ...
<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="105" height="23">
<param name="BASE" value=".">
<param name=movie value="view.swf">
<param name=quality value=high>
<param name="BGCOLOR" value="#FFFFCC">
<embed src="view.swf" base="." quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="105" height="23" bgcolor="#FFFFCC">
</embed>
</object>
</form>


Try both out to see if any work...

Make sure that in the setttings of you flash button, there is no target set. This is to make sure the javascript runs propperly.

If nonoe of this works, send me your full code, and i will have a look at it.

twocool
04-14-2003, 09:00 AM
<!--#include file="../include/dbconn.asp"-->
<html>
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<body bgcolor="#FFFFCC">
<%
vreqType = Request("vreqType")
vReqtrEmail = Request("vReqtrEmail")
'vReqNo = Request("ReqNo")
vAppnId = Request("vAppnId")
vreqTitle = replace(trim(Request("vreqTitle")),"'","''")
'vreqTitle = server.URLencode(trim(Request("vreqTitle")))
vDesiredDt = Request("vDesiredDt")
vReqtr = replace(trim(Request("vReqtr")),"'","''")
'date = Request("date()")
vContactNo = Request("vContactNo")
vDept = replace(trim(Request("vDept")),"'","''")
vRC = Request("vRC")
vPriority = Request("vPriority")
vfuncReq = server.URLencode(trim(Request("vfuncReq")))
vFreqVol = server.URLencode(trim(Request("vFreqVol")))
vSavings = Request("vSavings")
vRevenue = Request("vRevenue")
vBenefit = server.URLencode(trim(Request("vBenefit")))
vTester = replace(trim(Request("vTester")),"'","''")
vTesterContact = Request("vTesterContact")
vApprovOfficer = replace(trim(Request("vApprovOfficer")),"'","''")
vApprovEmail = Request("vApprovEmail")
%>
<% 'validate input

if vReqtr = "" then
Response.write ("<br> Error: Please enter Requestor Name. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)">
<% Response.End()
end if
if vContactNo = "" then
Response.write ("<br> Error: Please enter Requestor Contact. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)" id=button1 name=button1>
<% Response.End()
end if

if vRC = "" then
Response.write ("<br> Error: Please enter RC. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)" id=button2 name=button2>
<% Response.End()
end if
if vAppnId = "" then
Response.write ("<br> Error: Please enter Name of Application. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)" id=button3 name=button3>
<% Response.End()
end if
if vreqTitle = "" then
Response.write ("<br> Error: Please enter Request Title. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)" id=button4 name=button4>
<% Response.End()
end if
if vfuncReq = "" then
Response.write ("<br> Error: Please enter Functional Requirement. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)" id=button5 name=button5>
<% Response.End()
end if
if vApprovOfficer = "" then
Response.write ("<br> Error: Please enter Approving Officer Name. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)" id=button6 name=button6>
<% Response.End()
end if
if vApprovEmail = "" then
Response.write ("<br> Error: Please enter Approving Officer Name Email. <br><br>")%>
<input type=button value="Back" onClick="history.go(-1)" id=button7 name=button7>
<% Response.End()
end if
%>
<%
'sql1 = "select ReqMonth from ReqNoRef where ReqMonth = " (Month(Now))
sql1 = "select ReqYear, LastReqNo from ReqNoRef where ReqMonth = (Month(getDate()))"
set rs=MSCS.execute(sql1)

if not rs.eof then
'Reset Year
if rs("ReqYear") <> Year(now()) then
LastNo = 1
else
LastNo = rs("LastReqNo") + 1
end if
'Format Request Number
strLastNo = right("000" & cstr(LastNo),4)
'Format Month
strMonth = right("0" & cstr(month(date())),2)
'Format Request No
ReqNo = "RQ" & cstr(year(date())) & strMonth & strLastNo

'Format day
strDay = right("0" & cstr(day(date())),2)
'Format Request Date
ReqDt = strDay & "/" & strMonth & "/" & cstr(year(date()))

'Begin Transactions
MSCS.Errors.Clear
MSCS.BeginTrans

'Insert Request
sql="INSERT INTO Requests (ReqNo,ReqType,AppnId,reqTitle,ReqDt,DesiredDt,Reqtr,ReqtrEmail,ContactNo,Dept,RC,Priority,funcReq,F reqVol,Savings,Revenue,Benefit,Tester,TesterContact,ApprovOfficer,ApprovEmail)"
sql=sql & " VALUES "
sql=sql & "('" & ReqNo & "',"
sql=sql & "'" & vreqType & "',"
sql=sql & "'" & vAppnId & "',"
sql=sql & "'" & vreqTitle & "',"
sql=sql & "'" & ReqDt & "',"
sql=sql & "'" & vDesiredDt & "',"
sql=sql & "'" & vReqtr & "',"
sql=sql & "'" & vReqtrEmail & "',"
sql=sql & "'" & vContactNo & "',"
sql=sql & "'" & vDept & "',"
sql=sql & "'" & vRC & "',"
sql=sql & "'" & vPriority & "',"
sql=sql & "'" & vfuncReq & "',"
sql=sql & "'" & vFreqVol & "',"
sql=sql & "'" & vSavings & "',"
sql=sql & "'" & vRevenue & "',"
sql=sql & "'" & vBenefit & "',"
sql=sql & "'" & vTester & "',"
sql=sql & "'" & vTesterContact & "',"
sql=sql & "'" & vApprovOfficer & "',"
sql=sql & "'" & vApprovEmail & "')"
'Response.Write "Update command" & sql
'Response.End

MSCS.execute(sql)

'Update Last Request No into ReqNoRef
if rs("ReqYear") <> Year(now()) then
sql = "update ReqNoRef set ReqYear='" & Year(now())& "', LastReqNo = LastNo where ReqMonth = (Month(getDate()))"
else
sql = "update ReqNoRef set LastReqNo='" & LastNo & "' where ReqMonth = (Month(getDate()))"
end if
' Response.Write "Update command" & sql
' Response.End
MSCS.execute(sql)

if MSCS.Errors.Count = 0 then
MSCS.CommitTrans
Response.Write "New IS Request successfully saved <BR>" %>
<form name="viewForm" method="post" action="display_form.asp"><!-- onsumbit="return validate()"-->
<input type="hidden" name="vReqNo" value="<%=ReqNo%>">
<!--input type="hidden" name="vAppnId" value="<%=vAppnId%>">
<input type="hidden" name="vreqTitle" value="<%=vreqTitle%>">
<input type="hidden" name="vDesiredDt" value="<%=vDesiredDt%>">
<input type="hidden" name="vReqtr" value="<%=vReqtr%>"-->
<!--input type="hidden" name="vdate" value="<%=date()%>"-->
<!--input type="hidden" name="vContactNo" value="<%=vContactNo%>">
<input type="hidden" name="vDept" value="<%=vDept%>">
<input type="hidden" name="vRC" value="<%=vRC%>">
<input type="hidden" name="vPriority" value="<%=vPriority%>">
<input type="hidden" name="vfuncReq" value="<%=vfuncReq%>">
<input type="hidden" name="vFreqVol" value="<%=vFreqVol%>">
<input type="hidden" name="vSavings" value="<%=vSavings%>">
<input type="hidden" name="vRevenue" value="<%=vRevenue%>">
<input type="hidden" name="vBenefit" value="<%=vBenefit%>">
<input type="hidden" name="vTester" value="<%=vTester%>">
<input type="hidden" name="vTesterContact" value="<%=vTesterContact%>">
<input type="hidden" name="vApprovOfficer" value="<%=vApprovOfficer%>">
<input type="hidden" name="vApprovEmail" value="<%=vApprovEmail%>"-->
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="100" height="22">
<param name=movie value="view.swf">
<param name=quality value=high>
<param name="BGCOLOR" value="#FFFFCC">
<embed src="view.swf" base="" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="#FFFFCC">
</embed>
</object>

</form>

<% else
MSCS.RollbackTrans
Response.Write DBConn.Errors.Number
Response.Write "Warning: saving new IS request failed"
end if
end if

rs.close
set rs=nothing

'redirecturl = "request_type.asp"
'Response.Redirect redirecturl
%>
<%
'Function URLDecode(ByVal What)
''URL decode Function
''2001 Antonin Foller, PSTRUH Software, http://www.pstruh.cz
' Dim Pos, pPos
'
' 'replace + To Space
' What = Replace(What, "+", " ")
'
' on error resume Next
' Dim Stream: Set Stream = CreateObject("ADODB.Stream")
' If err = 0 Then 'URLDecode using ADODB.Stream, If possible
' on error goto 0
' Stream.Type = 2 'String
' Stream.Open
'
' 'replace all %XX To character
' Pos = InStr(1, What, "%")
' pPos = 1
' Do While Pos > 0
' Stream.WriteText Mid(What, pPos, Pos - pPos) + _
' Chr(CLng("&H" & Mid(What, Pos + 1, 2)))
' pPos = Pos + 3
' Pos = InStr(pPos, What, "%")
' Loop
' Stream.WriteText Mid(What, pPos)
'
' 'Read the text stream
' Stream.Position = 0
' URLDecode = Stream.ReadText
'
' 'Free resources
' Stream.Close
' Else 'URL decode using string concentation
' on error goto 0
' 'UfUf, this is a little slow method.
' 'Do Not use it For data length over 100k
' Pos = InStr(1, What, "%")
' Do While Pos>0
' What = Left(What, Pos-1) + _
' Chr(Clng("&H" & Mid(What, Pos+1, 2))) + _
' Mid(What, Pos+3)
' Pos = InStr(Pos+1, What, "%")
' Loop
' URLDecode = What
' End If
'End Function
%>

<% 'send email to approval officer

'sql1 = "select ReqTitle from Requests where ReqNo = ReqNo"
'set rs2=MSCS.execute(sql1)

sql = "select * from ReqTypeRef where ReqType='" & vreqType& "'"
set rs1 = MSCS.Execute(sql)
ReqDesc = rs1("ReqDes")
rs1.close
set rs1=nothing

Set Mailobj = Server.CreateObject("CDONTS.NewMail")

Mailobj.From = "ConBiz IS Request (" & vReqtrEmail & ")"
Mailobj.To = vApprovEmail
Mailobj.Bcc = "wenxiang@singtel.com"
Mailobj.Subject = "New IS Request for Approval"
Mailobj.Body = "Hi " & vApprovOfficer & "!" & vbCrLf & vbCrLf & _
"Request Type: " & ReqDesc & "" & vbCrLf & _
"Application Name: " & vAppnId & "" & vbCrLf & _
"Request No: " & ReqNo & "" & vbCrLf & _
"Request Title: " & vreqTitle & "" & vbCrLf & _
"Requestor: " & vReqtr & "" & vbCrLf & vbCrLf & vbCrLf &_
"Please click on the embedded hyperlink below to endorse the request." & vbCrLf & _
"http://sg_05_webdev:87/default.asp" & vbCrLf

Mailobj.Send
Set Mailobj = Nothing

'rs2.close
'set rs2=nothing

%>
</body>
</html>
<!--#include file="../include/dbclose.asp"-->

david7777
04-14-2003, 09:42 AM
I took the following code from the code you gave me and tested it by its self...
The flash button must have the link "javascript:window.document.viewForm.submit()" to work with the form.


<form name="viewForm" method="post" action="display_form.asp">
<input type="hidden" name="vReqNo" value="<%=ReqNo%>">
<object classid="clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="100" height="22">
<param name="movie" value="view.swf">
<param name="quality" value="high">
<embed src="view.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" ></embed>
</object>
</form>


It works fine like this for me, so it should be fine on your side :)
:cool:

twocool
04-14-2003, 10:10 AM
Brother i got it working.. finally.. thanks a lot..

david7777
04-14-2003, 10:23 AM
No problem - Glad I could help :D

twocool
04-14-2003, 10:41 AM
<input type="submit" name="insert" value="Submit" onClick="return VerifyData(form1)">&nbsp;&nbsp;
<input type="reset" name="reset" value="Reset">&nbsp;&nbsp;
<input type="button" name="cancel" value="Cancel" onclick="javascript:window.history.back(-1)">



i want to change them to flash buttons... then how will it work then

i changed my first button submit to flash button... then my VerifyData seems.. to be working differently.... use to be pop up message nows its goes to the nxt page.....

need yr help in this?

david7777
04-14-2003, 11:22 AM
Ok, well - here it goes...
<input type="reset" name="reset" value="Reset">
Make the flash button with the link "window.document.viewForm.reset()" where viewForm is the name of your form.

<input type="button" name="cancel" value="Cancel" onclick="javascript:window.history.back(-1)">
Make the flash button with the link "javascript:window.history.back(-1)"

<input type="submit" name="insert" value="Submit" onClick="return VerifyData(form1)">
This is a bit of a tough one...

You will have to make a new javascript function. ie:


function viewIt(){
if(VerifyData(form1)){
window.document.form1.submit();
}else{
alert("Not all fields are vald!");
}
}

And make the flash button with the link "javascript:viewIt()"

Take out the "onSubmit" part from the form - this wont be used any more.

twocool
04-15-2003, 02:15 AM
<input type=button value="Back" onClick="history.go(-1)" id=button7 name=button7>

<input type="submit" name="submit" value="Close">


how to do for close and back buttons......
can teach me...

twocool
04-15-2003, 03:59 AM
bro i got the back and close buttons.. working... i knew wat to do already..

but now my reset is not working... cant reset the form......

i put link it isnt working... need r help:(

david7777
04-15-2003, 10:42 AM
javascript:window.document.viewForm.reset() should work fine - Just remember to have the "javascript:" (no spaces) in front of it, and to change viewForm(in bold above) to whatever you named your form...

twocool
04-16-2003, 01:56 AM
thanks bro so much... i finally got working that u taught me :) :thumbsup:

bro i got something for u ask u...
i want to refresh the particular page.... i have to press F5 but it doesnt refresh the page.... it straight goes to my home page.. i found it troublesome.. is there anyway i can solve it...
i using frames...


becos... i always edit the code try the refresh the particular page.. it automatically goes to my home...

david7777
04-16-2003, 08:28 AM
Thats really weird - is it only the one page that has that problem, or is it all of them?
If it is all of them, then there is a problem with the browser you are using - a bug or something. If it is just the one page, then there must be something in the page that makes it refresh to the home page...

If you just want to refresh a certain frame, then you could just right click in the frame that you want to refresh, then click "refresh" that will not refresh the whole page, just that frame...



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum