13 Replies Latest reply on Dec 6, 2007 3:35 PM by Günter Schenk

    Edit form problem for fields with drop down list

      Greetings!

      I have a form to use to edit a record online. It works fine EXCEPT for those fields for which there is a list/menu or check boxes.

      I think I have tried all the various options under the 'properties' section but nothing seems to work. When the edit form is accessed, all the text fields are filled in properly EXCEPT the list/menu fields and the check in field. They simply show the list the same way they are shown on my 'add record' field. But if I click on one of the options in the list, it clears the field in the record when I click to update.

      Is it possible to have the existing data in the field shown? Then if it needs to be changed, the ability to use the list/menu to update the field? The ability to use the list/menu is important as the folks I am doing this site for are totally new to websites and anything that has anything to do with databases.

      I am using Dreamweaver CS3 and mysql and phpadmin on the host server.

      Any suggestions would be very appreciated!!
        • 1. Re: Edit form problem for fields with drop down list
          Günter Schenk Level 4
          Hi Mary,

          ---------
          But if I click on one of the options in the list, it clears the field in the record when I click to update
          ---------

          it seems that your list doesn´t have any values defined despite of the existing "labels" it displays -- how did you set up that list, with static value/label pairs, or based on a recordset ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Edit form problem for fields with drop down list
            Level 1
            Edit form problem for fields with drop down list<br /><br />I added the lists when I set up the 'add form'.  Then I copied the form to use for the edit form.  When you add a new record and choose values from the drop down lists, it adds the values correctly.<br /> <br />This is what the code looks like.  I used the 'properties/dynamic' section to generate it.  The drop down list does not exist in the Mysql database rather in my "add new" form.<br /> <br /> <tr><br />      <td width="462"><div align="right">Visible:  </div></td><br />      <td width="472"><label><br />        <input name="visible" type="checkbox" id="visible" value="1" /><br />      Yes <br />      <input name="visible2" type="checkbox" id="visible2" value="0" /><br />      No</label></td><br />    </tr><br />       <tr><br />      <td><div align="right">Gender:  </div></td><br />      <td><label><br />        <select name="gender" id="gender"><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['gender']))) {echo "selected=\"selected\"";} ?>>Select One</option><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['gender']))) {echo "selected=\"selected\"";} ?>>Dog</option><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['gender']))) {echo "selected=\"selected\"";} ?>>*****</option><br />          <?php<br />do {  <br />?><br />          <option value="<?php echo $row_rs_dogs['dog_id']?>"<?php if (!(strcmp($row_rs_dogs['dog_id'], $row_rs_dogs['gender']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_dogs['dog_id']?></option><br />          <?php<br />} while ($row_rs_dogs = mysql_fetch_assoc($rs_dogs));<br />  $rows = mysql_num_rows($rs_dogs);<br />  if($rows > 0) {<br />      mysql_data_seek($rs_dogs, 0);<br />   $row_rs_dogs = mysql_fetch_assoc($rs_dogs);<br />  }<br />?><br />        </select><br />      </label></td><br />    </tr><br />    <tr><br />      <td><div align="right">Title - Third:  </div></td><br />      <td><label><br />        <select name="Title3" id="Title3"><br />          <option> </option><br />          <option>Ch</option><br />          <option>Am Ch</option><br />          <option>Can Ch</option><br />          <option>Int Ch</option><br />                </select><br />      </label></td><br />    </tr><br />     <tr><br />      <td><div align="right">OFA Hips:  </div></td><br />      <td><label><br />        <select name="ofa_hips" id="ofa_hips"><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>>Later or NA</option><br /><option value="" <?php if (!(strcmp("", $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>>Excellent</option><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>>Good</option><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>>Fair</option><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>>Prelim Excellent</option><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>>Prelim Good</option><br />          <option value="" <?php if (!(strcmp("", $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>>Prelim Fair</option><br />          <?php<br />do {  <br />?><br />          <option value="<?php echo $row_rs_dogs['dog_id']?>"<?php if (!(strcmp($row_rs_dogs['dog_id'], $row_rs_dogs['ofa_hips']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rs_dogs['dog_id']?></option><br /><?php<br />} while ($row_rs_dogs = mysql_fetch_assoc($rs_dogs));<br />  $rows = mysql_num_rows($rs_dogs);<br />  if($rows > 0) {<br />      mysql_data_seek($rs_dogs, 0);<br />   $row_rs_dogs = mysql_fetch_assoc($rs_dogs);<br />  }<br />?><br />                </select><br />      </label></td><br />    </tr>
            • 3. Re: Edit form problem for fields with drop down list
              Günter Schenk Level 4
              Hi Mary,

              as you might have noticed when looking at your post, these forums regretfully can make a real mess of pasted code -- the next time I suggest to rather provide a link to a .txt file on your host that´s containing the complete page code.

              Fortunately I could open your post in "edit mode" and have a look at that -- as I assumed, most of your lists have an empty value, examples:

              1. the "gender" menu :: option value="" (for "Dog" and "*****")

              2. the "Title - Third" menu :: all list´s "options" don´t even have a value="" attribute -- it´s clear that this list can´t update anything

              3. the "OFA Hips" menu :: option value="" (for all entries)

              All in all, this seems to be a manually created form containing several errors and not an ADDT "dynamic form". Would it be possible to rather use ADDT´s dynamic forms for all that, what wouldn´t produce these errors ?

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Edit form problem for fields with drop down list
                Level 1
                I sent a response to this yesterday but don't see it now! Hmmmm, wonder what I did wrong!?

                What is an ADDT dynamic form?

                I did not do any of the coding in my form by hand. I was trying to follow the instructions in the help files and a Lynda.com video. Obviously, I did not understand the instructions very well!!

                I will go back and start over on them but I would love to know that the ADDT forms you referred to are.

                Thanks for your help!
                • 5. Re: Edit form problem for fields with drop down list
                  Level 1
                  Hi Again: I just started over with my edit page. These are the steps I followed for the 'list' fields. I did exactly what I thought the help files said to do but they do not work. None of my list fields are being updated. Maybe you can see what I am doing wrong.
                  I created an html form and table and a list box.
                  Clicked on the list field
                  Under "type" I clicked "list"
                  Then I clicked on the "dynamic" button which brings up a box called 'Dynamic Menu/list'.
                  In this box:
                  'Menu' is grayed out but says 'The field name in form form1'
                  "static options' list the options in my list field - I left it as it is.
                  "Options from Record Set" I chose the record set I set up.
                  "Values" I chose the field I am working with
                  "Labels" I chose the field that matches the values field although I had not set up labels when I created the list rather I put them in manually.
                  "Set value equal to" I chose my field and now it says "".

                  After I completed the properties section for each field, I went to "Server Behaviors" and clicked on "Update Record".

                  I have a check box field and it works. All the plain old text fields work. The only fields that do not work are these list boxes.

                  I am getting very frustrated. I hope you can see what I am doing wrong. Thanks so much!
                  • 6. Re: Edit form problem for fields with drop down list
                    Günter Schenk Level 4
                    Hi Mary,

                    ------
                    What is an ADDT dynamic form?
                    ------

                    humm -- I have the vague impression that you´re not using the "Adobe Dreamweaver Developer Toolbox" (http://www.adobe.com/products/dreamweaver/addt/) Dreamweaver extension at all, and if so, I gotta say you´re in the wrong forums :-)

                    Cheers,
                    Günter Schenk
                    Adobe Community Expert, Dreamweaver
                    • 7. Re: Edit form problem for fields with drop down list
                      Level 1
                      Hi Gunter: I will go to that website and hopefully will see what you mean. Thanks so much for trying to help!!
                      • 8. Re: Edit form problem for fields with drop down list
                        Level 1
                        I downloaded the trial version of ADDT [I did not realize that ADDT was an actual program or should I say program extension and that I have been posting to the wrong Forum - my apologies!].

                        Anyway, I don't understand the instructions for the "Update Record Wizard" any better than I did the Update behavior in Dreamweaver without the extension.

                        This is what I did for the list called "Gender".

                        It's Label is "Gender", to be displayed as a "Menu", submit as "text".

                        I clicked on "Menu Properties" to enter the options for the menu/list. I populated the list manually "select one", "Dog" and "*****".

                        What does it want for the "Label" and "Values"? Or I guess I need to understand what they will be used for. If I have my cursor on "Select One" from the list I created, they are both automatically filled with that [Select One]. If I place the cursor on "Dog" or "*****", it fills these boxes with them.

                        I presume that the "set value equal to" is looking for the field to update?? I chose "Gender" from the record set I am working with.

                        I already set up the record set [I think I had to in order to even start this process] so I did not set up another.

                        I clicked "Next" then checked to indicate that it is a required field. I did not choose any form of validation.

                        Then I clicked to finish.

                        I now have a list with [hint][error] next to each field. What do they mean?

                        Thanks again for your help!
                        • 9. Re: Edit form problem for fields with drop down list
                          Günter Schenk Level 4
                          Hi Mary,

                          -----
                          What does it want for the "Label" and "Values"? Or I guess I need to understand what they will be used for.
                          -----

                          Regardless if a dynamic list gets populated by values derived from a database query, or if you´re entering stuff manually, you will always need to provide a complete value & label pair -- the "value" will be submitted to the database, wheras the "label" is what´s getting displayed in the list.

                          -------
                          I presume that the "set value equal to" is looking for the field to update??
                          -------

                          yes -- this will compare an already submitted value for your "Gender" column with all the value/label options you provided and add a "selected" attribute to the matching option.

                          ------
                          I clicked "Next" then checked to indicate that it is a required field. I did not choose any form of validation
                          ------

                          checking a certain column as required field will be triggering a form validation later at least for the form element you´re attaching it to.

                          ------
                          I now have a list with [hint][error] next to each field. What do they mean?
                          ------

                          these are sort of placeholders which will be replaced with e.g. the "please select an option from the list" error message once the form validation gets triggered.

                          In case you see some sense in rather using ADDT than DW´s native server behaviours, I´d like to point you to the tutorials mentioned in these forums

                          Cheers,
                          Günter Schenk
                          Adobe Community Expert, Dreamweaver
                          • 10. Re: Edit form problem for fields with drop down list
                            Level 1
                            Hi Gunter! Yes, I'd like to be able to use the tutorials while I evaluate ADDT. [It is awfully pricey though and I hate paying that much more because I cannot get Dreamweaver to work by itself!! ]

                            Thank you SO MUCH for your help and patience! I am just an old dog trying to learn new tricks and get rather frustrated at times!
                            • 11. Re: Edit form problem for fields with drop down list
                              Günter Schenk Level 4
                              Hi Mary,

                              -------
                              because I cannot get Dreamweaver to work by itself!
                              -------

                              well, I think this the main point when judging whether ADDT will be a good choice or not :: understanding Dreamweaver´s *native* server behaviours (respectively what you can do with them already) would be what I´d suggest to learn first -- because ADDT´s huge set of features is usually considered valuable by those who´d like to go *beyond* what DW has to offer, but you don´t necessarily need ADDT to implement rather basic stuff.

                              The problem I see is :: ADDT itself is quite a "monster" in terms of complexity & features, but as it´s an extension of what & how DW handles things, you´ll most likely fail to get the best out of ADDT as long you´re insecure with handling the DW-native basics well.

                              ------
                              I am just an old dog
                              ------

                              a shorthair or longhair dog ? never mind, woof-woof to you :-)

                              ------
                              get rather frustrated at times
                              ------

                              yes, sigh, building web applications can be scary ;-) However IMHO there´s some excellent help available in DW´s help file already, and I consider (inter alia) the topics "Making pages dynamic" and "Building applications visually" a well-written resource for beginners.

                              Cheers,
                              Günter Schenk
                              Adobe Community Expert, Dreamweaver
                              • 12. Re: Edit form problem for fields with drop down list
                                Level 1
                                Well, since I find the instructions hard to follow I would like to give the tutorials you mentioned a try. My best success in learning has been with the Lynda.com videos. So, if you don't mind, please tell me how I can locate the tutorials you mentioned. Thanks!
                                • 13. Re: Edit form problem for fields with drop down list
                                  Günter Schenk Level 4
                                  ADDT´s starter tutorials "Building a contact management application" and "Building an Image Gallery" are here : http://www.adobe.com/devnet/dreamweaver/developer_toolbox.html

                                  Cheers,
                                  Günter Schenk
                                  Adobe Community Expert, Dreamweaver