View Single Post
  #1 (permalink)  
Old Mar 14th, 2008, 16:55
EvanLugh EvanLugh is offline
New Member
Join Date: Mar 2008
Location: England, You-Kay?
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Form extending, help please?

Hi, thanks for looking.
I have this form:
Code: Select all
<html>
<title>Pfft</title>
<body>
<form id="dlForm" onsubmit="GoToUrl(this.id); return false;">
<select id="format">
  <option value="rss">RSS</option>
  <option value="webcal">iCal</option>
  <option value="outlook">Outlook</option>
</select>
<select id="month">
  <option value="may">February 2008</option>
  <option value="mar">March 2008</option>
  <option value="apr">April 2008</option>
  <option value="may">May 2008</option>
  <option value="jun">June 2008</option>
</select>
<input type="submit" value="Download" />
</form>
<script type="text/javascript">
var base = 'http://www.myspo......res.com/';
var calBase = 'myspor.....gfixtures.com/test/phpicalendar-0.9.5/calendars/';
function GoToUrl(id)
{
  var url = '';
  // identify by form id. Helpful if there's more than one form on page
  if (id == 'dlForm') {
    // get value attribute from first select tag
    format = document.getElementById('format').value;
    // get value attribute from second select tag
    month = document.getElementById('month').value;
    switch (format) {
      case 'rss':
        url = base +'test/phpicalendar-0.9.5/rss/rss.php?cal='+
         month +'&rssview=week'; break;
      case 'webcal':
        url = 'webcal://'+ calBase +''+ month +'.ics'; break;
      case 'outlook':
        url = 'http://'+ calBase +''+ month +'.ics'; break;
    }
//alert(url);
    location.href = url;
  }
}
</script></body>
</html>
Now it works brilliantly, but I would like to extend it.
As well as the form above (it selects a format, RSS, iCal, Outlook. And then downloads the appropriate file to the month) I would like to have check boxes to select certain files to download.
I might be confusing myself but basically:

I select Outlook. I want updates for the month March2008. Then I would like to select who i would like fixtures for (tick boxes). Example: Soccer / Football team 1, team 2 ETC.

I'm not even sure if it's possible, but if it is help would be appreciated please. I also understand that the directory system would have to be changed, so help on this would be greatly appreciate too.
Thanks.
Reply With Quote