Results 1 to 2 of 2

Thread: How to fill a Select-Field depending on other value

  1. #1
    New user
    Join Date
    09-15-12.
    Posts
    2

    Default How to fill a Select-Field depending on other value

    Hi,

    we just changed our website from normal html,php and css to contao but now we got some trouble with a form.
    The programmer who did the conversion for us sad, that the following problem could not be solved with contao. So lets have a try:

    In our former site we got a form with two select-field which got their values from a database. The first field contains about 1000 values. The second field change their values depending on the value of the first field. Overall 5000 values for the second field but mostly about 5-10 after the selection of the first value.

    With ajax and php we loaded the values of the second field after the selection of the other field but this was with our old site. Has anyone a idea how to do this with contao?

    I tried the extension "conditionalselectmenu" but i don't want to typ the 5000 values by hand. an other reason to not use this is, that this extension doesn't work with autoform which is used for "i don't know but the programmer installed it".

  2. #2
    User Andreas's Avatar
    Join Date
    07-11-09.
    Location
    Mönchengladbach
    Posts
    499

    Default Re: How to fill a Select-Field depending on other value

    With contao you can save values in any table. If you fill in a table name and this table does not exist, here comes autoform into play. It creates that table for you but watch out, it does not delete it. If you don't need this or some other features of autoform you don't need autoform, you manage xour tables by yourself e.g. with phpmyadmin.

    There ist an extension which brings you a field select-DB or similar, maybe it's EFG try to search.

    The xmlHTTPRequest in FE can be done with MooTools http://mootools.net/docs/core/Request/Request

    The php file that does the sql statements and brings the response to FE has to be in templates folder. In system\libraries\Database.php you find usefull methods for your DB conversations.

    A short tutorial about ajax in contao you can find here http://blog.qzminski.com/2010/06/ajax-in-contao/

    I'm working to little with ajax in contao so I don't know how you get access to contaos classes in your php file like e.g. in a contaos template file. e.g. you have to import the Database class first.

    $this->import('Database');
    $this->Database->query(...
    Web-Development, Freelancer, Burgtech, XHTML, HTML5, CSS, PHP, Javascript, MooTools, MySQL and more
    Amazon wishlist

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
  •