PerfectForms Forums » Behaviors

Fill Drop down from Table

(18 posts)
  1. capson
    Member

    Hello, is it possible to populate a drop down from a table i.e say column 1 is a column of names I want to populate a drop down with these names. Have tried with set field but no luck. Thanks

    Posted 2 years ago #
  2. ijobling
    Member

    Afraid not if you are referring to the same form instance, but it can be done with 'connections' to /from an external database (or form connection) where you write the table contents out to your DB/form and then read them back into a drop down object using the 'connect' actions.

    Posted 2 years ago #
  3. capson
    Member

    Thanks for the reply.

    Posted 2 years ago #
  4. capson
    Member

    Follow up question, are you saying I can create a form-Database-Table and make a connection to my main form and have it fill the drop down, if so will this effect any of the behaviors or notifications of the form.

    Posted 2 years ago #
  5. ijobling
    Member

    sort of, although you can use a form OR a database table. using the database functions will require the Connection Agent module though (contact sales@perfectforms.com for details on that) but with a form you can use a form connection.
    have a look at the userguide on integration to see what is involved with this.
    http://www.perfectforms.com/Documentation/manual/html/d_connectionsintegration.htm

    it won't effect any other behaviours or notifications. the key will be how to write the data out from your table on this main form into the other form (or database table) and then how to then read that data into your drop down. if the drop down is on another page of your form then you could do the 'write' on the 'show next page' action and then the 'read' on the 'when page is opened' on the page that has the drop down ?

    Posted 2 years ago #
  6. capson
    Member

    ijobling, thanks for your responses. Here is what I am tiring to do. I have a main form with 11 pages (call it mainform), page 11 is a set up page, it has a drop down box amongst other things which when a persons name is selected populates various input boxes in the other 10 pages. I have a second form called DBform, it has a table with sales people's names, gender ect...
    I want to populate the drop down box on the set up page of mainform with the names from the table on my DBform. I have read about connections and played with making one but am a little lost on how to proceed.
    Do I create a Insert or update connection, am I inserting in to drop down box or updating a drop down box, do I start from the mainform or DBform. Sorry to ask such basic questions but I am not getting how to proceed. Your advice is appreciated.

    Posted 2 years ago #
  7. ijobling
    Member

    If I were you I would put the 'mainform' to one side and create yourself a simple test form to work with so you can prove the concept and see what it does..
    set up your form connection ACTION to READ from your DBform where you set up the RETURN parameters to the column in your table that stores the names. You don't specifically need any 'send parameters'. you will then be shown TEST.. try it to see what it returns (ie it should return the content of that table from your form instance on the DBForm table)
    then on your 'test' form, add in a drop down and a button. under the button set up your 'connect' action to this form action and then preview the form, hit the button and you should see the drop down populating.
    in terms of populating a drop down from a connection, note that in the Return Parameters section of the Connect script , check the Items option corresponding to the field you want to populate you list or drop-down object with

    Posted 2 years ago #
  8. capson
    Member

    Thank you for your response I will work on your suggestions.

    Posted 2 years ago #
  9. capson
    Member

    ijobling, got it Thanks again.

    Posted 2 years ago #
  10. capson
    Member

    ijobling, I got the connection working and now have 5 drop down boxes. I need to say choses the 4th caption from dd box 1 and have the 4th captions from dd box 2 through 5 be chosen. Is it possible to create a behavior like this I have tried using various methods but have not been able to find a way. Thanks

    Posted 2 years ago #
  11. ijobling
    Member

    if you mean you want to select from drop down 1 for that to automatically cause the other drop downs to be 'selected', then use the SetField script to set these other fields to the state - checked

    but over all of this, if your need is to have one drop down where the users are making a decision and these other fields are all stored in your external form, why not just have the one drop down populated from the 'connection' action and then when the users select from the first do another 'connection' to your external form to write the other information back into other (perhaps text) fields on the form

    Posted 2 years ago #
  12. capson
    Member

    ijobling, thanks again for your response they are all very helpful. I will think on your suggestion.

    Posted 2 years ago #
  13. capson
    Member

    ijobling, another question. Every thing works in preview mode i.e I have 5 drop down boxes have a connection, my drop down boxes populate. Under dd box1 I have a behavior on a data change event. So that when I select from drop down 1 this automatically cause the other drop downs to be 'selected'. This all works in preview mode or edit form mode. But when I open my form in view mode the dd boxes populate via the connection but the behaviors do not work. The first choice is selected and can not be changed. Is there a way to correct this, would your suggestion above correct this. Thanks

    Posted 2 years ago #
  14. ijobling
    Member

    look when you are previewing what 'stage' and 'role' the form is running in. when you deploy the form and load it, it will be in the first 'stage' of your form and the ALL role. If these are different then review your field states. if the objects you are trying to write into are 'disabled' for instance you will not be able to write into them. but also it could be if you have written your behaviours under a condition that isn't being satisfied in this stage/role.

    look also at the 'debug' function where you can select the stage and role for the form and then preview in 'debug' mode where you will then see all the form actions listed out in the debug pain

    Posted 2 years ago #
  15. capson
    Member

    ijobling, once again thank you for your response all is working fine. I did not have the stage set. Everything is pleasingly generalized in that there is no personal info hard coded in to my child form, it all comes from my parent form. I have one more step and that is to create a parent child relationship between my Parent form(DBform) and my child form(testform).

    I created an input field(to store InstanceID) call it DB-InstID and a button on DBform.

    Under the button behavior I have:

    Start-setfield DB-InstID to empty-Submitdata-ShowForm-Exit.

    Showform: I am choosing Single Child and DB-InstID to hold the InstanceID.

    The child has a behavior on form open, were I have my connection set.

    In my DBform I populate my table, then click my button. The testform opens, the drop down boxes fill, but the drop down boxes have additional choices from previous instances. Is there any way to have the drop down boxes have only the input from the most recent Instance?

    Posted 2 years ago #
  16. ijobling
    Member

    if you have the same 'unique' instance ID stored on both the parent AND the child form, use that within your connection as the 'where' clause (look at how the 'send parameter' in the connect action is used) so that it only returns information where these fields are the same.

    Posted 2 years ago #
  17. capson
    Member

    Hello ijobling, I have ground to a halt, I can not figure out how to set the same 'unique' instance ID to store on both the parent AND the child form!

    Posted 2 years ago #
  18. ijobling
    Member

    check the interactive example form for parent/child where all the various methods are shown and there you will see how to pass data from the parent into the child
    http://www.perfectforms.com/Documentation/manual/html/fl_parent_and_child_forms_example_2.htm

    Posted 2 years ago #

RSS feed for this topic

Reply

You must log in or register to post.

Contact

1917 Palomar Oaks Way
Suite 160
Carlsbad, CA 92008
866.900.8588

  picture  picture  picture  picture