7 Replies Latest reply on Sep 24, 2011 9:15 AM by MurraySummers

    radio buttons

    homebrews

      Trying to put six radio buttons into two different tables, Having done that so that only one button can be chosen at one time, am having trouble linking. When checked in a browser the link, a pdf file, comes up black. Have tried placing the pdf file in different folders, but not success. Same results if using Spry buttons.

       

      here is an example. Sometimes it says 404 page not found.

       

      It seems to work only after checking some of the other buttons and not getting the desired results. Then, suddenly out of oz, the buttons start to work. At least that is what has been just experienced with this page. This time it took only one extra attempt to get all buttons to work correctly. Hopefully, there is an answer to this dilemma.

       

      Thank you.

       

      Kim

        • 1. Re: radio buttons
          MurraySummers Level 8

          You cannot apply a link around form elements like this -

           

          <a href="downloads/1.pdf">

                <label>

                  <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_3" />

                  Basic</label>

              </a>

           

          You will instead need to use javascript to trigger the download like this -

           

          <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_3" onclick="download('pdf_filename');">

           

          You will also have to put this function definition in the head of the page -

           

          <script type="text/javascript">

          function download(pdffile) {

                    window.location=pdffile;

          }

          </script>

          • 2. Re: radio buttons
            homebrews Level 1

            Many thanks for the help. Did what was suggested and eliminagted <a href= part and replaced 'pdf_filename' with the actual pdf. No results. Left the <input name ... > with the actual pdf name + the <a href= part and it worked. Is this what you are suggesting?

             

            Also added the <script before </head>.

            • 3. Re: radio buttons
              MurraySummers Level 8

              No that's not what I am suggesting.  I want you to try the suggestion I made exactly as I made it:

               

              Add this to the head of the page (while in Code view) -

               

              <script type="text/javascript">

              function download(pdffile) {

                        window.location=pdffile;

              }

              </script>

               

              (perhaps by placing it immediately above </head>)

               

              Then change your radio button code so that it looks like this -

               

              <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_3" onclick="download('pdf_filename');">

               

              Now try clicking on that radio button.

              • 4. Re: radio buttons
                homebrews Level 1

                Thanks for the response.

                 

                Here is exactly what was added:

                 

                this in the head:

                 

                <script type="text/javascript">

                function download(pdffile) {

                          window.location=pdffile;

                }

                </script>

                </head>

                 

                and this with the appropriate button with no <a href link:

                 


                <label>

                <input type="radio" name="RadioGroup1" value="radio" id="RadioGroup1_5" onclick="download('pdf_filename');"/>

                Basic</label>

                 

                And this is the result:

                 

                Not Found

                The requested URL /test/pdf_filename was not found on this server.

                 

                which you can verify here.

                 

                Appears  that 'pdf_filename' is a variable with nothing assigned to it. And if that is the case then six variables are needed, n'est ce pas?

                 

                Thanks for the help.

                 

                Kim

                • 5. Re: radio buttons
                  MurraySummers Level 8

                  You're almost there.  In each case, replace "pdf_filename" that appears in the <input> tag with the actual filename that you want to be downloaded by the click.  That will be a different filename for each radio button, right?

                   

                  What happens now?

                  • 6. Re: radio buttons
                    homebrews Level 1

                    Tres bien! Exactly as expected. merci for your help and patience.

                    • 7. Re: radio buttons
                      MurraySummers Level 8

                      Ne rien.  Bon chance.