12 Replies Latest reply on Jun 12, 2008 6:00 AM by (BoomTk1)

    Dependent Drop Down

    Level 1
      IS there are way to include more than one field in the the wdg:displayfield.

      I have two fields i want to include there, is it possible
        • 1. Re: Dependent Drop Down
          Günter Schenk Level 4
          Hi Joe,

          just combine two columns using a CONCAT function in your query, like this:

          SELECT CONCAT(first_name," ",last_name) AS full_name, column_three, column_four FROM tablename

          ...and have the wdg:displayfield display the alias column "full_name"

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Dependent Drop Down
            Level 1
            Is there away to put static text in there.

            Lets say i have Columns Office_Name and Office_City and i want it display it like this: Office_Name(Office_City) or like this

            State Farm(Chicago)

            Thanks for your help gunter
            • 3. Re: Dependent Drop Down
              Level 1
              Another problem: here is the query statement

              $query_rsAdj = "SELECT * ,CONCAT(AdjLName,", ",AdjFName) AS AdjFullName FROM tbladjustercontact";

              It works when i test it in dreamweaver but when i load the page in my browser the page is just white nothing comes up no error, its just a blank page.

              Any ideas
              • 4. Re: Dependent Drop Down
                Level 1
                Also what if there is no entry in one of the fields, when i view that that record doesnt show if one column is empty. How do i fix that?

                Thanks
                • 5. Re: Dependent Drop Down
                  Level 1
                  Here is the code that is causing the AdjOffFull to have a null value if one of the fields of the CONCAT is Empty

                  SELECT AdjOffID, CONCAT(AdjOfficeName," ( ",AdjOffCity," ) ") AS AdjOffFull FROM tbladjusteroffice ORDER BY AdjOffID

                  Any thoughts??
                  • 6. Re: Dependent Drop Down
                    Günter Schenk Level 4
                    ---- <br />Is there away to put static text in there. <br /> <br />Lets say i have Columns Office_Name and Office_City and i want it display it like this: Office_Name(Office_City) or like this <br /> <br />State Farm(Chicago) <br />---- <br /> <br />try with this: <br /> <br />CONCAT(AdjLName, '(', AdjFName, ')') AS AdjFullName <br /> <br />----- <br />It works when i test it in dreamweaver but when i load the page in my browser the page is just white nothing comes up no error, its just a blank page <br />----- <br /> <br />If you get a totally blank page, you´re facing a PHP error, and in case the error reporting has been deactivated in your server´s php.ini, you can´t see what´s wrong. But you can activate error reporting for a single file by adding the following on line 1: <br /> <br /><?php<br />error_reporting(E_ALL ^ E_NOTICE);<br />?> <br /> <br />However, I *think* you´ll just need to replace the double quotes in my first CONCAT example with single quotes, like I already did in the new example posted above. <br /> <br />Cheers, <br />Günter Schenk <br />Adobe Community Expert, Dreamweaver
                    • 7. Re: Dependent Drop Down
                      Level 1
                      That works as far as getting the static text, however like i said, lets say i have a first name but no last name entered

                      The FullName from the CONCAT will show up as null instead of just showing the first name for that record.

                      Any thoughts

                      THanks Gunter
                      • 8. Re: Dependent Drop Down
                        Günter Schenk Level 4
                        ------
                        The FullName from the CONCAT will show up as null instead of just showing the first name for that record.

                        Any thoughts
                        ------

                        oh I see -- I reckon you´ll have to implement some CASE expressions in your SQL query, like explained here: http://www.craigsmullins.com/ssu_0899.htm

                        Whatever method you´re deciding on, you´ll have to implement some logic in your query which checks if the last_name column IS NULL (or not) and "do something else"

                        However, MySQL CASE expressions aren´t supported by Dreamweaver, and such a modified query will no longer be editable by DW´s recordset UI plus displayed as red exclamation mark in the Server Behaviours lists, what does not mean the query is broken under "real" conditions.

                        Cheers,
                        Günter Schenk
                        Adobe Community Expert, Dreamweaver
                        • 9. Re: Dependent Drop Down
                          Günter Schenk Level 4
                          Hi Joe,

                          ------
                          if one of the fields of the CONCAT is Empty
                          ------

                          humm, if actually both columns could be empty, doesn´t it mean that your wdg:displayfield might have nothing to show, regardless if you´re displaying one column (AdjOfficeName or AdjOffCity) or both columns as CONCAT ? If so, the whole thing is getting more complicated, however I suggest to modify the query to:

                          SELECT AdjOffID, AdjOfficeName, AdjOffCity, CONCAT(AdjOfficeName," ( ",AdjOffCity," ) ") AS AdjOffFull FROM tbladjusteroffice ORDER BY AdjOffID

                          ...so that it´s possible to implement an advanced PHP if/else condition in your form for displaying alternate "slave" dropdown menus based on the following conditions:

                          a) if AdjOfficeName *and* AdjOffCity are empty, display the AdjOffID value

                          else

                          b) if AdjOfficeName *and* AdjOffCity are not empty, display the CONCAT alias

                          else

                          c.1) if AdjOfficeName is empty, display the AdjOffCity value

                          c.2) else if AdjOffCity is empty, display the AdjOfficeName value

                          Cheers,
                          Günter Schenk
                          Adobe Community Expert, Dreamweaver
                          • 10. Re: Dependent Drop Down
                            Level 1
                            Gunter thank you for directing in the right direction. I did figure out a way to do it while keeping the Dreamweaver Recordset Editable.

                            I wrote a sql statement and stored it as a view, here is the statement

                            Select AdjID, AdjOffID, CONCAT(COALESCE(tbladjustercontact.AdjLName, ''),", ",COALESCE(tbladjustercontact.AdjFName, '')) AS AdjFullN, AdjLName FROM tbladjustercontact

                            This way it replaces a null with a blank using the COALESE inside the CONCAT. I had to add another AdjLName field in the view to be able to sort by the last name because for some reason the concat field does not like to be sorted. Now when i go to dreamweaver and set a recordset it treats the view like a normal table. Displaying the CONCAT FIELD Like this

                            Smith, John
                            , John
                            Smith,

                            Which i am okay with the Comma showing up if one of the fields is null

                            What you think??
                            • 11. Re: Dependent Drop Down
                              Is there a way in ADDT to make a txt field required depending on what is selected in a drop down?
                              For example, if the ship-to country selected is the United States, is it possible to make the County field required in such a case?

                              Cheers
                              • 12. Re: Dependent Drop Down
                                Can this be done using SPRY and ADDT?

                                If the user selects USA then the menu in the next row in the form changes from PROVINCE to STATE? and if the user selects CANADA it is reversed?