Announcement

Collapse
No announcement yet.

[SOLVED]Use AJAX to reload other fields of type Select Bug

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [SOLVED]Use AJAX to reload other fields of type Select Bug

    Im trying to use the field feature of reloading other field of type select when a change occurs in this field. The select clause of the field to be reloaded depends on the value of the changed field. The bug is that when the field being changed has no values, the list of values of the field to be reloaded is not reset (emptied). Help please. Is there a form that I can do it manually.
    Thank you.

  • #2
    Re: Use AJAX to reload other fields of type Select Bug

    Let me suggest that you have 2 fields (field1 and field2).

    onchange field1 AJAX feature : please type this -->

    //if value of field1 is empty, erase field2 content.
    if({field1}=='')
    {
    {field2}='';
    }


    Suyono

    Comment


    • #3
      Re: Use AJAX to reload other fields of type Select Bug

      Im sorry but I didnt explain the problem very well. This is the way it should be:
      Im trying to use the field feature of reloading other field of type select when a change occurs in this field. The select clause of the field to be reloaded depends on the value of the changed field. The bug is that when the field to be reloaded has no values for that particular value of the field being changed, the list of values of the field to be reloaded is not reset (emptied). Help please. Is there a form that I can do it manually.
      Thank you.

      By the way assigning a value to a field of type select only set the value to be displayed, but not the entire list. How can I reset the entire list manually?

      Comment


      • #4
        Re: Use AJAX to reload other fields of type Select Bug

        There is a tutorial on this topic.

        http://www.scriptcase.net/phpgenerat...rch/grid31.php

        If your select loaded is blank, that is because your lookup value statement has error.

        Here is an example:
        Have two fields - Race and Sub-Race
        You will need 3 tables, Race table, SubRace table, RaceSubRace table

        Race field -> 1. set field type as Select
        2. set automatic lookup to Race table
        Code:
        SELECT idRaces, Race 
                          FROM races 
                          ORDER BY Race
        SubRace field -> 1. set field type as Select
        2. set automatic lookup to SubRace table
        Code:
        SELECT idSubRaces, SubRace 
                          FROM subraces 
                          ORDER BY SubRace
        Now go back to the Race field -> 1. enable Ajax Processing
        2. double-click on field SubRace as the field to be reloaded

        Now go back to the SubRace field -> 1. set automatic lookup to
        Code:
                                         SELECT idSubRace, SubRace 
                                         FROM racesubrace 
                                         WHERE idRaces = '{Race}'
                                         ORDER BY SubRace

        Comment


        • #5
          Re: Use AJAX to reload other fields of type Select Bug

          It doesn't work for me.
          This is what I have:
          Application Type: Form
          Table: Addresses
          Fields: AddressID,
          LocationID,
          Street,
          ZipPostcode,
          *Location,
          *District,
          *Province,
          *Department
          Where Fields with asterisk are calculated fields of type select.

          Field 1.
          Name: Department
          SQL Automatic Lookup: SELECT DepartmentID, Name
          FROM Departments
          ORDER BY Name
          Use AJAX to reload other field: *Province

          Field 2.
          Name: Province
          SQL Automatic Lookup: SELECT ProvinceID, Name
          FROM Provinces
          WHERE DepartmentID='{Department} '
          ORDER BY Name

          Comment


          • #6
            Re: Use AJAX to reload other fields of type Select Bug

            As I said it before: When I select a department that has provinces it resets the field provinces correctly, but if the department has no provinces it just ignores the field.

            Comment


            • #7
              Re: Use AJAX to reload other fields of type Select Bug

              i think this case depend on your database schema.
              to be clear you should tell us not only table addresses but also department and province.

              to automatically fill province field. you have to link table between department and province first then make query based your approach.
              use on ajax change on field department to fill province field.

              suyono

              Comment

              Working...
              X