SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Jun 2003
    0 Post(s)
    0 Thread(s)

    Open new window to preview form content

    I do have a form with 4 buttons - 1 one them is a preview button and "OnClick" there should be a new window opened showing the form data. I can't use the window.opener because the text of the textarea is modified by a PHP Scirpt (regular expressions etc.).
    I found the following solution in this forum by Alarion:

    <script language=javascript>
    function previewForm() {
    var newsTitle, newsBody;

    newsTitle = document.formname.fieldname1.value;
    newsBody = document.formname.fieldname2.value;'filename.php?op=previewpost&title='+newsTitle+'&body='+newsBody, 'preview', '');

    I assume filename.php is the name of the PHP Script, &title='newsTitle+' and '&body='+newsBody submits the value of the form textareas or text inputs. I dont understand what "op=previewpost" means, what does the "?" mean, what does the "preview" mean and can somebody explain the syntax at the tag ?

  2. #2
    011521 dbalsdon's Avatar
    Join Date
    Feb 2003
    North Of Scotland
    0 Post(s)
    0 Thread(s)'filename.php?op=previewpost&title='+newsTitle+'&body='+newsBody, 'preview', '');

    in the above code... filename.html is the file that will be displayed in the window that is opened... and inside the last set of 's... you can decide what attributes the window will have.. eg.. will it have scrollbars, a status bar, menu ect... so in the code above.. the page
    filename.php?op=previewpost$title='+newstitle+'&body='+newsBody will be opened...

    somebody else will be able to explain what the ? and all the info after that is for... as my explanation would probably just confuse u...
    Last edited by dbalsdon; Jul 18, 2003 at 07:21.
    Daniel Balsdon
    My Site


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts