SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Kingston
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Value test on new page

    I have a form on a page that the user fills out. When he's done and it's validated, I need the contents along with some other stuff to be printed before it's sent to the server. To accomplish this I'm using window.open on the Print button, then I intend to reference the fields from the page which opened it using the window.opener.formname.fieldname.value .

    Problem is I have couple sets of radio buttons on the form that was filled out and I would like to print all the radio buttons showing the selected one so that the user acknowledges on the hard copy what his choices were.

    If I was doing it server-side(ASP), I'd test the value of the incoming form value by executing a function, and I'd like to do it that way too, but I can't seem to figure out how to do that without putting <SCR IPT>function...</SCR IPT> tags with every radio button <INP UT> tag.

    This also applies to where I'd like to write the values as HTML.

    Is there an easier way? ...

  2. #2
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Kingston
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I didn't even test my theory ... I just realized that I can't use < SCRIPT > tags inside an HTML tag, even if it was the clumsiest way.

    I need to reprint a set of radio fields on a page opened with window.open and show the selection from the opening page.

    Where do I go from here ...?

  3. #3
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Kingston
    Posts
    246
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The solution (for those of you who may have been interested):
    Code:
    <SCRIPT>
    for (i=0;i<window.opener.formname.radiofield.length;i++){
      document.write('<INPUT TYPE="RADIO" ')
      if (window.opener.formname.radiofield[i].checked==true) {
         document.write(' CHECKED ') 
         }
      document.write('> ' + window.opener.formname.radiofield[i].value + ' ' )
    }
    </SCRIPT>
    I figured it out a while ago and is longer than I would have like but it works ... what the heck, I have a deadline to meet.


Bookmarks

Posting Permissions

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