Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15

Thread: Help with a script to deline members of a certain age

  1. #11
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Hi,

    I have a form processor and the form seen on that link does actually work and submit.

    I use Bluevoda and the form processor is something call ABVFP.

    Regards
    Rob

  2. #12
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Hmm, I see, That seems to be a pre-factured processor and im not really sure how you could add this age plugin to that. It may be better to age validate through javascript, this would be a simmilar approach.

    After quick googling, I found http://www.kuranes.co.uk/utils/agecheck.html
    Code:
    <script language="javascript">
    		function checkAge()
    		{
    			/* the minumum age you want to allow in */
    			var min_age = 8;
                var max_age = 18;
    
    			/* change "age_form" to whatever your form has for a name="..." */
    			var year = parseInt(document.forms["age_form"]      ["year"]      .value);
    			var month = parseInt(document.forms["age_form"]      ["month"]      .value) - 1;
    			var day = parseInt(document.forms["age_form"]      ["day"]      .value);
    
    			var theirDate = new Date((year + min_age), month, day);
    			var today = new Date;
    
    			if ( (today.getTime() - theirDate.getTime()) < 0) {
    				alert("Get Out, Scum!");
    				return false;
    			}
    			else {
    				return true;
    			}
    		}
    	</script>
    HTML:
    Code:
    <form action="http://www.kuranes.co.uk" method="get" name="age_form">
    Day : <select name="day">
    	<option>1</option>
    	<option>2</option>
    
    	<option>3</option>
    	<option>4</option>
    	<option>5</option>
    	<option>6</option>
    	<option>7</option>
    	<option>8</option>
    
    	<option>9</option>
    	<option>10</option>
    	<option>11</option>
    	<option>12</option>
    	<option>13</option>
    	<option>14</option>
    
    	<option>15</option>
    	<option>16</option>
    	<option>17</option>
    	<option>18</option>
    	<option>19</option>
    	<option>20</option>
    
    	<option>21</option>
    	<option>22</option>
    	<option>23</option>
    	<option>24</option>
    	<option>25</option>
    	<option>26</option>
    
    	<option>27</option>
    	<option>28</option>
    	<option>29</option>
    	<option>30</option>
    	<option>31</option>
    </select>
    
    Month : <select name="month">
    	<option>1</option>
    	<option>2</option>
    	<option>3</option>
    	<option>4</option>
    	<option>5</option>
    
    	<option>6</option>
    	<option>7</option>
    	<option>8</option>
    	<option>9</option>
    	<option>10</option>
    	<option>11</option>
    
    	<option>12</option>
    </select>
    
    Year : <select name="year">
    	<option>2003</option>
    	<option>2002</option>
    	<option>2001</option>
    	<option>2000</option>
    
    	<option>1999</option>
    	<option>1998</option>
    	<option>1997</option>
    	<option>1996</option>
    	<option>1995</option>
    	<option>1994</option>
    
    	<option>1993</option>
    	<option>1992</option>
    	<option>1991</option>
    	<option>1990</option>
    	<option>1989</option>
    	<option>1988</option>
    
    	<option>1987</option>
    	<option>1986</option>
    	<option>1985</option>
    	<option>1984</option>
    	<option>1983</option>
    	<option>1982</option>
    
    	<option>1981</option>
    	<option>1980</option>
    	<option>1979</option>
    	<option>1978</option>
    	<option>1977</option>
    	<option>1976</option>
    
    	<option>1975</option>
    	<option>1974</option>
    	<option>1973</option>
    	<option>1972</option>
    	<option>1971</option>
    	<option>1970</option>
    
    	<option>1969</option>
    	<option>1968</option>
    	<option>1967</option>
    	<option>1966</option>
    	<option>1965</option>
    	<option>1964</option>
    
    	<option>1963</option>
    	<option>1962</option>
    	<option>1961</option>
    	<option>1960</option>
    	<option>1959</option>
    	<option>1958</option>
    
    	<option>1957</option>
    	<option>1956</option>
    	<option>1955</option>
    	<option>1954</option>
    	<option>1953</option>
    	<option>1952</option>
    
    	<option>1951</option>
    	<option>1950</option>
    	<option>1949</option>
    	<option>1948</option>
    	<option>1947</option>
    	<option>1946</option>
    
    	<option>1945</option>
    	<option>1944</option>
    	<option>1943</option>
    	<option>1942</option>
    	<option>1941</option>
    	<option>1940</option>
    
    	<option>1939</option>
    	<option>1938</option>
    	<option>1937</option>
    	<option>1936</option>
    	<option>1935</option>
    	<option>1934</option>
    
    	<option>1933</option>
    	<option>1932</option>
    	<option>1931</option>
    	<option>1930</option>
    	<option>1929</option>
    	<option>1928</option>
    
    	<option>1927</option>
    	<option>1926</option>
    	<option>1925</option>
    	<option>1924</option>
    	<option>1923</option>
    	<option>1922</option>
    
    	<option>1921</option>
    	<option>1920</option>
    	<option>1919</option>
    	<option>1918</option>
    	<option>1917</option>
    	<option>1916</option>
    
    	<option>1915</option>
    	<option>1914</option>
    	<option>1913</option>
    	<option>1912</option>
    	<option>1911</option>
    	<option>1910</option>
    
    	<option>1909</option>
    	<option>1908</option>
    	<option>1907</option>
    	<option>1906</option>
    	<option>1905</option>
    	<option>1904</option>
    
    	<option>1903</option>
    </select>
    
    <input type="submit" name="_send_date_" value="Go" onClick="return checkAge()">
    </form>
    </div>
    However this is veering from PHP and of course it will not work if you disable javascript. You may want to post in the javascript section of this site for further help if you run into problems.
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  3. #13
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your help.

    Javascript can also work and I will try the other link offered.

    Again the challenge is how to insert it?

    I appreciate your help

    Regards
    Rob

  4. #14
    Join Date
    Nov 2006
    Location
    Northeast USA
    Posts
    408
    Thanks
    8
    Thanked 30 Times in 28 Posts

    Default

    Paste the javascript code into the current javascript you provided my with, and then use the select boxes for the date of birth, but yes, I suggest you make a javascript topic about this and how to implement it, as javascript is not my forte.
    -Ben -- THE DYNAMIC DRIVERS
    My Links: My DD Profile||My Youtube Video Tutorials||DD Helping Coders||DD Coders In Training
    I told my client to press F5, the client pressed F, then 5, *facepalm*

  5. #15
    Join Date
    May 2007
    Location
    South Africa
    Posts
    175
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Will do thanks Ben

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
  •