Gossamer Forum
Home : Products : DBMan : Customization :

Multi Select and Select All Problem

Quote Reply
Multi Select and Select All Problem
Hi Everyone
Can anyone help? I have read through a load of the 'multi selection' solutions but none seem to solve the following:
Basically, I need a way for the user to be able to select from a range of dates (month only - jan, mar, oct...12 months max) always starting from current month.
The user should also be also to select 'all'. the months should then be stored in one db so that I can then link it to the ad info for that month. If this is possible then the ideal format would be checkbox's in a grid 4x3
A big ask i think but any sort of solution would be greatly appreciated.

Last edited by:

RobertR: Mar 8, 2009, 3:56 PM
Quote Reply
Re: [RobertR] Multi Select and Select All Problem In reply to
Problem Solved! well kind of anyway... someone kindly sent me this code below:

<script type="text/javascript">



function validate(nForm){

var nIssue = document.getElementsByName('issue');
var temp = [];
for (i=0; i<nIssue.length; i++)
{
if (nIssue.checked)
{
temp[temp.length] = nIssue.value;
}
}
if (temp.length == 0)
{
alert('You must select publication month(s)');
return false;
}
alert('Thank you. You chose:\n' + temp.join('\n'));
return true;
}

function init(){

var monthName = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
var refDate = new Date();
refDate.setHours(0,0,0,0);
var nIssue = document.getElementsByName('issue');
for (i=0; i<nIssue.length; i++)
{
nIssue.parentNode.firstChild.data = monthName[refDate.getMonth()] + " " + refDate.getFullYear();
nIssue.value = monthName[refDate.getMonth()] + " " + refDate.getFullYear();
refDate = new Date(refDate.getFullYear(),refDate.getMonth()+1,1);
}
}

navigator.appName == "Microsoft Internet Explorer" ? attachEvent('onload', init, false) : addEventListener('load', init, false);

</script>
<style type="text/css">

body {background-color: #fffacd; margin-top: 60px;}
form {width: 620px; margin: auto; font-family: 'times new roman'; font-size: 12pt;}
fieldset {width: 620px; padding-left: 10px; background-color: #eee8aa; border: 1px solid #e6b280;}
legend {font-family: arial; font-size: 14pt; color: #000000; background-color: transparent; padding-top: 3px;
padding-left: 3px; padding-right: 3px; margin-bottom: 5px;}
.issueLabel {font-family: tahoma; font-size: 10pt; margin-right: 10px;}
.submitBtn {background-color: #fff8dc; border: 1px solid #000000; font-family: arial; font-size: 10pt;
font-weight: bold; cursor: pointer; display: block; margin-left: auto; margin-right: auto;
margin-top: 5px; margin-bottom: 5px;}

</style>
</head>
<body>
<form action="" method="post" onSubmit="return validate(this)">
<fieldset>
<legend>Form</legend>

<label>Select Issue Publication Month(s)</label>
<br>
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;
<label class="issueLabel">&nbsp;<input type="checkbox" name="issue"></label>&nbsp;&nbsp;&nbsp;

<input type="submit" name="submit" value="Submit" class="submitBtn">

However, first off I was trying to work out how to change the code so that the 'issue' field became issue1,issue2 to match each month. But! thee must be an easier way to do this... I will explain in next post
</fieldset>
</form>
Quote Reply
Re: [RobertR] Multi Select and Select All Problem In reply to
Ok! this is what I am trying to achieve...

Ad Bookings - each of the mags should be able to take bookings for each month upto a max of 12 (random or consecatively), but each month the ad can change size, orientation, page, prime location and maybe in a feature. so this needs to be optional when adding and/or modifying record

So I have tried a number of ideas and they kind of work! but I am concerned with the number of fields and database size.

I curently have one booking database with the following fields:

Booking ID
Customer ID
Month1
....
Month12
AdSize1
....
AdSize12
AdOrientation1
....
AdOrientation12
AdPage1
....
AdPage12
AdFeature1
.....
AdFeature12
AdCost1
.....
AdCost12
AdInvoiceNo1
.....
AdInv12

This method ends up with over 100 fields, is that to many?

Any suggestions would be greatly appreciated
Quote Reply
Re: [RobertR] Multi Select and Select All Problem In reply to
If I were to setup the bookings database as follows:

BookingID
CustomerID
Month
AdSize
AdOrientation
AdPage
AdFeature
AdCost
AdInvoiceNo

Thereby massively reducing the number of overall firlds, are you able to add multiple record to one db from one add form?