Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - `Submit` changing roles
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

`Submit` changing roles

 Post Reply Post Reply Page  <12
Author
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 7:46pm

There's some code missing like the OpenPreviewWindow function is not there, seeing your code i figure you have done changes to that function as well, can you post the whole thing...?

FeRnAN
Back to Top
Munk View Drop Down
Newbie
Newbie
Avatar

Joined: 11 December 2002
Location: United States
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote Munk Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 7:52pm

Sure - At first, as in the first posting, I was pulling the same preview window code that comes with the forums, which is this...

function OpenPreviewWindow(targetPage, formName){

now = new Date

//Open the window first
openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')

//Now submit form to the new window
formName.action = targetPage + "?ID=" + now.getTime();
formName.target = "preview";
formName.submit();
}

Since then, I've made a different copy of it, that doesn't add the time ID for cache purposes. I made it as simple as possible, renamed the functionand the respective calling code, and here that replacement is...  (which, btw, didn't help either)

function OpenPoemPreview(targetPage, formName){
openWin('','preview','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=680,height=400')
formName.action = targetPage
formName.target = "preview";
formName.submit();
}

Btw.. I do appreciate all of your help looking at this, fernan82 - one day I hope to have a site member gathering, and I'll have to send you an invite so I can buy ya a brew!

<EDIT> I'm getting the actual preview code together so I can post that, too. I can't see any possible reason it should affect it, but hey, if I had the answers, I wouldn't be here right now LOL



Edited by Munk
Back to Top
Munk View Drop Down
Newbie
Newbie
Avatar

Joined: 11 December 2002
Location: United States
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote Munk Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 8:05pm

Here's the poem preview code in it's full entirety, with the exception of the DB includes for it.

<% @ Language=VBScript %>
<% Option Explicit %>

<%
Response.Buffer = True

Dim strPoem

Dim strPoemBack
Dim strBGPath
Dim MyQuery

Response.Expires = 0
Response.ExpiresAbsolute = Now() - 2
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "private"

strPoem = Request.Form("poem")
strPoemBack = Request.Form("new_poem_back")

if strPoemBack = "No Background" Then strPoemBack = ""
if strPoemBack <> "" Then
MyQuery = "SELECT BG_Name, Path FROM Backs WHERE BG_Name = '" & strPoemBack & "'"
Call OpenDBPoems
poemRS.Open MyQuery
if NOT poemRS.EOF Then
strBGPath = poemRS("Path")
poemRS.Close
Call CloseDBPoems
else
strBGPath = strPoemBack
Call CloseDBPoems
end if
end if

If Request.Form("browser") = "IE" Then

strPoem = WYSIWYGFormatPost(strPoem)

Else
strPoem = FormatPost(strPoem)
End If

strPoem = checkHTML(strPoem)

If strPoem = "" OR IsNull(strPoem) Then
strPoem = "<br /><br /><div align=""center"">" & strTxtThereIsNothingToPreview & "</div><br /><br />"
End If

Set rsCommon = Nothing
adoCon.Close
Set adoCon = Nothing
%>
<html>
<head>
<title>Poem Preview</title>
<HTTP-EQUIV=
"PRAGMA" CONTENT="NO-CACHE">

<!--#include file="includes/skin_file.asp" -->
</head>
<body bgcolor=
"<% = strBgColour %>" text="<% = strTextColour %>" background="<% = strBgImage %>" marginheight="0" marginwidth="0" topmargin="0" leftmargin="0" OnLoad="self.focus();">
<table width="<% = strTableVariableWidth %>" border="0" cellspacing="0" cellpadding="1" align="center" height="53">
<tr>
<td align="center" height="17"><span class="heading">Poem Preview</span></td>
</tr>
<tr>
<td align="center" height="39"><a href="JavaScript:onClick=window.close()">Close Preview Window</a></td>
</tr>
</table>
<table width="<% = strTableVariableWidth %>" border="0" cellspacing="0" cellpadding="1" bgcolor="<% = strTablePostsBorderColour %>" align="center">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="<% = strTablePostsEvenRowColour %>" background="<% = strBGPath %>" height="147">
<tr>
<td class="text" valign="top">
<% = strPoem %>
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="<% = strTableVariableWidth %>"

Back to Top
Munk View Drop Down
Newbie
Newbie
Avatar

Joined: 11 December 2002
Location: United States
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote Munk Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 8:24pm

Actually... I think I'm onto something. When the preview code is called, it's basically redefining the forms 'action' attribute to be the preview page title... so when returning to the main page, the form still has that attribute when it's submitted with the submit button.

Now all I need to do is figure out how boRg is handling that LOL

Back to Top
Munk View Drop Down
Newbie
Newbie
Avatar

Joined: 11 December 2002
Location: United States
Status: Offline
Points: 25
Post Options Post Options   Thanks (0) Thanks(0)   Quote Munk Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 8:41pm

WOO HOOOO !  I got it - the two additional lines added to the CheckForm function resets the form's attributes to the original, hence allowing the form to process correctly when returning to it.

Here the new code....

function CheckForm()
{ var returnValue = false;
document.frmAddPoem.poem.value = frames.poem.document.body.innerHTML;
if (document.frmAddPoem.title.value == "")
{ alert('A Poem isn`t a poem without a title...','Form Error');
document.frmAddPoem.title.focus(); }
else {
returnValue = true;
document.frmAddPoem.action="poetry_submit.asp"
document.frmAddPoem.target="_top"

}
return returnValue;
}

Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.