.: Programming Help .: Web (Dropdown)

මචන්ලා මේකයි case එක
Form එකේ dropdowns තුනක් තියනවා .
හිතපන්කෝ මෙහෙම :)
පලවෙනි dropdwon එක තමයි loan type, දෙවෙනි එක තමයි loan amount , තුන interest rate.

loan type (මේකේ values ගන්නේ db එකේ loan table එකකින් . Housing, personal, instant වගේ values loan type එකේ තියෙනවා).
දැන් දෙක තුන dropdown වලට load වෙන්න ඕන අර උඩ select කරපු values වලට අදාල table record එකට අයිති අනිත් values.
තව ටිකක් කියනවනම් මෙහෙමයි

හිතන්නකෝ පළවෙනියට මම housing select කලා loan type එක කියලා . Housing වලට අදාලව බැංකුවකින් දෙන loan amounts 3,4ක් තියෙනවා . මෙන්න මේ ඔක්කොම දෙවෙනි එකේ load වෙන්න ඕනේ. තුන් වෙනි එකෙත් එහෙමයි .

මේක jquery වලින් වගේ කරන්න පුලුවන්ද . නැත්තම් ajax ඕනෙද . මම නම් ajax දන්නේ නැහැ :(:(:(
දන්නා අයියා කෙනෙක් මට කියලා දෙන්නකො
jquery වලින් ගොඩ ඩගන්න පුලුවන්නම් එ විදිය පෙන්නන්න.ajax නතුව කරන්න පුලුවන්නන් තමයි හොද .
බම්ප් එකක් හරි කමක් නැහැ ගෙන පලයල්ලා

 

DJvodka

Well-known member
  • Mar 31, 2009
    3,375
    292
    83
    A land like no other
    jquery walin puluwan ajax karanna lesiyenma

    First combo ekata danawa onselect ekata call karanawa javascript function ekak.

    Code:
    function filter() {
            var type = $("#combo  option:selected").text();
            $.getJSON("path/to/JSON/resource?loan="+type, function(res) {
                $.each(res, function(i, field) {
                    $('#secondDropList').append($('<option/>', { 
                    value: value,
                    text : value 
        }));
                         
                });
            });
        }
     

    anton2

    Active member
  • Apr 1, 2009
    860
    129
    43
    Colombo
    try to understand this machan
    this is my data table


    database1_zps7d082c43.jpg



    and this is my two combo boxes
    in the "Property Category" combo box i just want to load only the
    types from the database


    when you select one category from the 1st combo box
    ......in the 2nd combo box which i named as
    "select your type" load only the available categories under the particular
    types in the database

    just try to understand what i have done


    sample_zpsbf20d1f0.jpg


    |
    |
    \/



    code for 1st combo box for load only the types
    so i used mysql "group by" query for it


    1combo_zpsc2d4ad03.jpg



    code for 2nd combo box
    just load only the particular category under the "type"
    you selected in the 1st combo box


    combo2_zpsf49c81c9.jpg


    note: i want to load in the 2nd combo box the things which i commented
    on the code
    okzzz

    type this code
    remember the id of the 2nd combo box should b match with the below
    code

    ajx_zps10ab1da5.jpg




    ----------------------------------

    if you have any problems
    skype:jayashan2
    or keep me a message
    hope its work

    Good Luck++++












     
    jquery walin puluwan ajax karanna lesiyenma

    First combo ekata danawa onselect ekata call karanawa javascript function ekak.

    Code:
    function filter() {
            var type = $("#combo  option:selected").text();
            $.getJSON("path/to/JSON/resource?loan="+type, function(res) {
                $.each(res, function(i, field) {
                    $('#secondDropList').append($('<option/>', { 
                    value: value,
                    text : value 
        }));
                         
                });
            });
        }
    ela machan. Thanks 4+
    try to understand this machan
    this is my data table


    database1_zps7d082c43.jpg



    and this is my two combo boxes
    in the "Property Category" combo box i just want to load only the
    types from the database


    when you select one category from the 1st combo box
    ......in the 2nd combo box which i named as
    "select your type" load only the available categories under the particular
    types in the database

    just try to understand what i have done


    sample_zpsbf20d1f0.jpg


    |
    |
    \/



    code for 1st combo box for load only the types
    so i used mysql "group by" query for it


    1combo_zpsc2d4ad03.jpg



    code for 2nd combo box
    just load only the particular category under the "type"
    you selected in the 1st combo box


    combo2_zpsf49c81c9.jpg


    note: i want to load in the 2nd combo box the things which i commented
    on the code
    okzzz

    type this code
    remember the id of the 2nd combo box should b match with the below
    code

    ajx_zps10ab1da5.jpg




    ----------------------------------

    if you have any problems
    skype:jayashan2
    or keep me a message
    hope its work

    Good Luck++++












    Thanks bun. Mata ajax nam terenne naha. Eth mama ube code eka try karannam. Elatama liyala thiyenaawa. 4+