www.webdeveloper.com
Results 1 to 4 of 4

Thread: Need help with submiting form

  1. #1
    Join Date
    Oct 2012
    Posts
    2

    Need help with submiting form

    I have a form.
    I need to select year, month, day and than send it with submit button.
    I need to insert value="" for filter_year, filter_month, filter_date to send with submit button.



    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Untitled Document</title>
    </head>

    <body>
    <div class="box_title">Wann?</div>
    <div class="box_content">
    <div class="left_data">
    <div class="cell"><label for="filter_month" >Von:</label></div>
    </div>
    <div class="right_data">
    <select name="filter_year" id="filter_year_id" onchange="hfcUpdateMonths()"><option>0</option></select>
    <select name="filter_month" id="filter_month_id" onchange="hfcUpdateDates()"><option>0</option></select>
    <select name="filter_date" id="filter_date_id"><option>0</option></select>
    </div>
    <form name="booking_0" action="../page.html" method="post">
    <input name="filter_duration" value="7" type="hidden">
    <input name="setlang" value="en" type="hidden">
    <input name="filter_model" value="16" type="hidden">
    <input name="filter_year" value="" type="hidden">
    <input name="filter_berths" value="" type="hidden">
    <input name="flags" value="1" type="hidden">
    <input name="filter_heads" value="" type="hidden">
    <input name="filter_cabins" value="" type="hidden">
    <input name="showgenericmodels" value="true" type="hidden">
    <input name="filter_country" value="HR" type="hidden">
    <input name="filter_date" value="" type="hidden">
    <input name="companyid" value="1211" type="hidden">
    <input name="filter_price" value="" type="hidden">
    <input name="filter_service_type" value="" type="hidden">
    <input name="filter_month" value="" type="hidden">
    <input name="filter_yachtage" value="-10000" type="hidden">
    <input name="filter_base" value="" type="hidden">
    <input name="filter_flexibility" value="on_day" type="hidden">
    <input name="filter_region" value="" type="hidden">
    <input name="filter_kind" value="" type="hidden">
    <input name="filter_length" value="" type="hidden">
    <input name="view" value="Booking" type="hidden">
    <input name="baseId" value="10" type="hidden">
    <input name="yachtId" value="2086380000100109" type="hidden">
    <input name="dateFrom" value="" type="hidden">
    <input name="dateTo" value="" type="hidden">

    <button type="submit">
    <table border="0" cellpadding="0" cellspacing="2">
    <tbody><tr><td valign="middle"><img src="/include/images/icons/bullet_go.png"></td>
    <td>Next</td></tr>
    </tbody></table>
    </button>

    </form>

    <script type='text/javascript'>
    <!--
    var hfcD = new Array();
    hfcD[0]={d:20,m:'Oktober (10)',mn:9,y:2012};
    hfcD[1]={d:27,m:'',mn:9,y:2012};
    hfcD[2]={d:3,m:'November (11)',mn:10,y:2012};
    hfcD[3]={d:10,m:'',mn:10,y:2012};
    hfcD[4]={d:17,m:'',mn:10,y:2012};
    hfcD[5]={d:24,m:'',mn:10,y:2012};
    hfcD[6]={d:1,m:'Dezember (12)',mn:11,y:2012};
    hfcD[7]={d:8,m:'',mn:11,y:2012};
    hfcD[8]={d:15,m:'',mn:11,y:2012};
    hfcD[9]={d:22,m:'',mn:11,y:2012};
    hfcD[10]={d:29,m:'',mn:11,y:2012};
    hfcD[11]={d:5,m:'Januar (1)',mn:0,y:2013};
    hfcD[12]={d:12,m:'',mn:0,y:2013};
    hfcD[13]={d:19,m:'',mn:0,y:2013};
    hfcD[14]={d:26,m:'',mn:0,y:2013};
    hfcD[15]={d:2,m:'Februar (2)',mn:1,y:2013};
    hfcD[16]={d:9,m:'',mn:1,y:2013};
    hfcD[17]={d:16,m:'',mn:1,y:2013};
    hfcD[18]={d:23,m:'',mn:1,y:2013};
    hfcD[19]={d:2,m:'März (3)',mn:2,y:2013};
    hfcD[20]={d:9,m:'',mn:2,y:2013};
    hfcD[21]={d:16,m:'',mn:2,y:2013};
    hfcD[22]={d:23,m:'',mn:2,y:2013};
    hfcD[23]={d:30,m:'',mn:2,y:2013};
    hfcD[24]={d:6,m:'April (4)',mn:3,y:2013};
    hfcD[25]={d:13,m:'',mn:3,y:2013};
    hfcD[26]={d:20,m:'',mn:3,y:2013};
    hfcD[27]={d:27,m:'',mn:3,y:2013};
    hfcD[28]={d:4,m:'Mai (5)',mn:4,y:2013};
    hfcD[29]={d:11,m:'',mn:4,y:2013};
    hfcD[30]={d:18,m:'',mn:4,y:2013};
    hfcD[31]={d:25,m:'',mn:4,y:2013};
    hfcD[32]={d:1,m:'Juni (6)',mn:5,y:2013};
    hfcD[33]={d:8,m:'',mn:5,y:2013};
    hfcD[34]={d:15,m:'',mn:5,y:2013};
    hfcD[35]={d:22,m:'',mn:5,y:2013};
    hfcD[36]={d:29,m:'',mn:5,y:2013};
    hfcD[37]={d:6,m:'Juli (7)',mn:6,y:2013};
    hfcD[38]={d:13,m:'',mn:6,y:2013};
    hfcD[39]={d:20,m:'',mn:6,y:2013};
    hfcD[40]={d:27,m:'',mn:6,y:2013};
    hfcD[41]={d:3,m:'August (8)',mn:7,y:2013};
    hfcD[42]={d:10,m:'',mn:7,y:2013};
    hfcD[43]={d:17,m:'',mn:7,y:2013};
    hfcD[44]={d:24,m:'',mn:7,y:2013};
    hfcD[45]={d:31,m:'',mn:7,y:2013};
    hfcD[46]={d:7,m:'September (9)',mn:8,y:2013};
    hfcD[47]={d:14,m:'',mn:8,y:2013};
    hfcD[48]={d:21,m:'',mn:8,y:2013};
    hfcD[49]={d:28,m:'',mn:8,y:2013};
    hfcD[50]={d:5,m:'Oktober (10)',mn:9,y:2013};
    hfcD[51]={d:12,m:'',mn:9,y:2013};
    hfcD[52]={d:19,m:'',mn:9,y:2013};
    hfcD[53]={d:26,m:'',mn:9,y:2013};
    hfcD[54]={d:2,m:'November (11)',mn:10,y:2013};
    hfcD[55]={d:9,m:'',mn:10,y:2013};
    hfcD[56]={d:16,m:'',mn:10,y:2013};
    hfcD[57]={d:23,m:'',mn:10,y:2013};
    hfcD[58]={d:30,m:'',mn:10,y:2013};
    hfcD[59]={d:7,m:'Dezember (12)',mn:11,y:2013};
    hfcD[60]={d:14,m:'',mn:11,y:2013};
    hfcD[61]={d:21,m:'',mn:11,y:2013};
    hfcD[62]={d:28,m:'',mn:11,y:2013};
    hfcSelectedDate = 20;
    hfcSelectedMonth = 9;
    hfcSelectedYear = 2012;
    function hfcSelectOption(hfcSelectElement, hfcValueToSelect)
    {
    for (count = 0; count < hfcSelectElement.options.length; count++)
    {
    if (hfcSelectElement.options[count].value == hfcValueToSelect)
    {
    hfcSelectElement.selectedIndex = count;
    return;
    }
    }
    }

    function hfcFillDates()
    {
    hfcLastValue = "";
    hfcYearSelect = document.getElementById("filter_year_id");
    hfcYearSelect.options.length = 0;
    for (count = 0; count < hfcD.length; count++)
    {
    if (hfcD[count].y != hfcLastValue)
    {
    hfcYearSelect.options[hfcYearSelect.length] = new Option(hfcD[count].y, hfcD[count].y);
    hfcLastValue = hfcD[count].y;
    }
    }
    hfcSelectOption(hfcYearSelect, hfcSelectedYear);
    hfcUpdateMonths();
    }

    function hfcUpdateMonths()
    {
    hfcLastValue = "";
    hfcMonthSelect = document.getElementById("filter_month_id");
    hfcMonthSelect.options.length = 0;
    hfcYear = document.getElementById("filter_year_id").value;
    for (count = 0; count < hfcD.length; count++)
    {
    if (hfcD[count].y == hfcYear && hfcD[count].m )
    {
    hfcMonthSelect.options[hfcMonthSelect.length] = new Option(hfcD[count].m, hfcD[count].mn);
    hfcLastValue = hfcD[count].m;
    }
    }
    hfcSelectOption(hfcMonthSelect, hfcSelectedMonth);
    hfcUpdateDates();
    }

    function hfcUpdateDates()
    {
    hfcLastValue = "";
    hfcDateSelect = document.getElementById("filter_date_id");
    hfcDateSelect.options.length = 0;
    hfcYear = document.getElementById("filter_year_id").value;
    month = document.getElementById("filter_month_id").value;
    for (count = 0; count < hfcD.length; count++)
    {
    if (hfcD[count].y == hfcYear && hfcD[count].mn == month)
    {
    hfcDateSelect.options[hfcDateSelect.length] = new Option(hfcD[count].d, hfcD[count].d);
    }
    }
    hfcSelectOption(hfcDateSelect, hfcSelectedDate);
    }
    hfcFillDates()
    //-->
    </script>

    <script>

    //do we need to filter services by country
    if (document.forms["box"].filter_country){
    value=document.forms["box"].filter_country.value;
    if (value!=""){
    filtered_country_code=value;filterServices('cc', value, 'si', s, 'filter_service');
    }
    }

    //do we need to filter models per base?
    if (document.forms["box"].filter_base){
    value=document.forms["box"].filter_base.value;
    if (value!=""){
    filtered_base_id=value;filterModels('bi', this.value, 'rti', m, 'filter_model')
    }
    }

    </script>


    </body>
    </html>

  2. #2
    Join Date
    Oct 2012
    Posts
    5
    too much code for i think a small problem, try to give only the useful informations

  3. #3
    Join Date
    Oct 2012
    Posts
    2

    Need help with submiting form

    Quote Originally Posted by m03bius View Post
    too much code for i think a small problem, try to give only the useful informations
    I have this form:
    <form name="booking_0" action="../page.html" method="post">
    <input name="filter_duration" value="7" type="hidden">
    <input name="setlang" value="en" type="hidden">
    <input name="filter_model" value="16" type="hidden">
    <input name="filter_year" value="" type="hidden">
    <input name="filter_berths" value="" type="hidden">
    <input name="flags" value="1" type="hidden">
    <input name="filter_heads" value="" type="hidden">
    <input name="filter_cabins" value="" type="hidden">
    <input name="showgenericmodels" value="true" type="hidden">
    <input name="filter_country" value="HR" type="hidden">
    <input name="filter_date" value="" type="hidden">
    <input name="companyid" value="1211" type="hidden">
    <input name="filter_price" value="" type="hidden">
    <input name="filter_service_type" value="" type="hidden">
    <input name="filter_month" value="" type="hidden">
    <input name="filter_yachtage" value="-10000" type="hidden">
    <input name="filter_base" value="" type="hidden">
    <input name="filter_flexibility" value="on_day" type="hidden">
    <input name="filter_region" value="" type="hidden">
    <input name="filter_kind" value="" type="hidden">
    <input name="filter_length" value="" type="hidden">
    <input name="view" value="Booking" type="hidden">
    <input name="baseId" value="10" type="hidden">
    <input name="yachtId" value="2086380000100109" type="hidden">
    <input name="dateFrom" value="" type="hidden">
    <input name="dateTo" value="" type="hidden">

    <button type="submit">
    <table border="0" cellpadding="0" cellspacing="2">
    <tbody><tr><td valign="middle"><img src="/include/images/icons/bullet_go.png"></td>
    <td>Next</td></tr>
    </tbody></table>
    </button>

    </form>

    1/ i have a date selection
    <select name="filter_year" id="filter_year_id" onchange="hfcUpdateMonths()"><option>0</option></select>
    <select name="filter_month" id="filter_month_id" onchange="hfcUpdateDates()"><option>0</option></select>
    <select name="filter_date" id="filter_date_id"><option>0</option></select>
    2/ I need to fill these value: filter_year, filter_month, filter_date from from date selection
    3/ send it to call page

  4. #4
    Join Date
    Jun 2009
    Location
    Chi town. IL68 ICAO code home airport, literally.
    Posts
    157
    Why don't you simplify your code and clean it up just for your sake and ours.

    If you want the date info including month, day, year, time, and such use PHP to pull this info directly from the server when the user submits the form. That will be the simplest way to get this info with minimal work on your part.

    And as for sending it to the call page, you can use the info you just pulled from the server to echo it back out into the page. KISS (Keep it simple stupid)
    For want of a nail...the horseshoe was lost. For want of a horseshoe, the steed was lost. For want of a steed...the message was not delivered. For want of an undelivered message.....the war was lost.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles