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
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 Topic: `Submit` changing roles
    Posted: 15 May 2003 at 9:34pm

I'm hoping that some of you WWG Forums gurus might have an answer here, although the question is more just ASP, so I'm posting it in here...

I'm working on a poetry submission area for my site, and I'm trying to incorporate the same type of processing as what WWG has in it's forums. On the poem editor, I have a preview, clear form, and submit, much like the forums. My problem is that is you click preview first (which works fine opening its own window), the submit function will also open the preview window afterwards. If you submit the poem without clicking the preview button, it submits just fine.

I have the buttons setup just like the forums, but can't get the submit to keep it's role consistent, no matter how many brain cells I fry trying to figure this out.  I'm hoping this to be more of a general issue, so I'm not posting code that most of you have possibly already seen many times. If I need to, though, I will...

Thanks in advance for any helpful info on this one!

Back to Top
MorningZ View Drop Down
Senior Member
Senior Member
Avatar

Joined: 06 May 2002
Location: United States
Status: Offline
Points: 1793
Post Options Post Options   Thanks (0) Thanks(0)   Quote MorningZ Quote  Post ReplyReply Direct Link To This Post Posted: 16 May 2003 at 7:29am
lets see some code!
Contribute to the working anarchy we fondly call the Internet
Back to Top
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 6:43pm

yea it would be helpful if you post the code...

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 6:46pm

I've taken out the table formatting to save space, since it's irrelevant...  here's what I have, very simple form setup (or so I thought it would be  ). I have the form-check function and reset here, the form, with a preview button, which opens a preview, much like the forums do. I even put the poem editor in an iframe like the forums. Maybe that has something to do with it? Who knows...  like I said, if I don't preview first, the form submits perfectly. If I preview first, after closing the preview window, the submit button actually does the exact same thing as the preview button, and opens the preview window/code.

 

<SCRIPT Language=Javascript>

function ResetForm(){

       if (window.confirm('<% = strResetFormConfirm %>')){
              frames.poem.focus();
              frames.poem.document.body.innerHTML = '';
              return true;
        }
        return false;            
}

 

function CheckForm()
{   var returnValue = false;
    if (document.frmAddPoem.title.value == "")
     { alert('A Poem isn`t a poem with a title...','Form Error');
     document.frmAddPoem.title.focus(); }
    else { returnValue = true; }
       return returnValue;
}

</SCRIPT>

 

<form method="post" name="frmAddPoem" action="poetry_submit.asp" onSubmit="return CheckForm();" onReset="return ResetForm();">

 

<input type="hidden" name="poem" value="" />

<input type="hidden" name="browser" value="IE" />

 

<script language="javascript">

document.write ('<iframe src="poem_textbox.asp?pb=<%= strPoemBack %>" id=

Back to Top
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:09pm

Give this a try:

 

<SCRIPT Language=Javascript>

function ResetForm(){

       if (window.confirm('<% = strResetFormConfirm %>')){
              frames.message.focus();
              frames.message.document.body.innerHTML = '';
              return true;
        }
        return false;            
}

 

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 with a title...','Form Error');
     document.frmAddPoem.title.focus(); }
    else { returnValue = true; }
       return returnValue;
}


</SCRIPT>

 

<form method="post" name="frmAddPoem" action="poetry_submit.asp" onSubmit="return CheckForm();" onReset="return ResetForm();">

 

<input type="hidden" name="poem" value="" />

<input type="hidden" name="browser" value="IE" />

 

<% Randomize Timer %>


<script language="javascript">

document.write ('<iframe src="poem_textbox.asp?pb=<%= strPoemBack %>" id="poem" width="500" height="200"></iframe>')

frames.poem.document.designMode = "On";

</script>

 

<input type="button" name="Preview" value="Preview Poem" onClick="document.frmAddPoem.poem.value = frames.poem.document.body.innerHTML; OpenPreviewWindow('poem_preview.asp?Pback=<%= strPoemBack %>', document.frmAddPoem);" />

<input type="reset" name="Reset" value="<% = strTxtClearForm %>" />

<input type="submit" name="Submit" value="Submit Poem" tabindex="30" />


</form>

 

<edit> nevermind i don't think that's the problem



Edited by fernan82
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:23pm

You're right... it turned out to not be the problem. A good thought, though, and I like that structure a little better, so thanks you in any case  :)

I'm baffled on this one. I may strip it down to trying it without an iframe, for poops and giggles, but in the end I know that's what I want. And since I run WWG forums, I know it can be done LOL.

Back to Top
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:32pm
do you have any more forms on the same page? like on the header or footer...?
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:41pm

Nope, sure don't... 'tis a single stand alone form. Basically, I'm setting it up so that the user has a choice of backgrounds, which is the first step. The background code is passed to this page, where there is a single form for editing the poem itself. You can see where I'm passing the background code to the appropriate areas for display while the user writes their poem. The whole thing is only being passed as a string argument as you navigate, so the backgroud code shouldn't even be a problem at all. It's really only used when the entry is added to the DB.  (Aside from display)

and please excuse my typo I made in the JS, when I said 'A poem isn`t a poem with a title'.  That was supposed to be 'without' a title LOL. Shows how late at night I was up playing around with this trying to make it work LOL

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.