#299 Add new entry. Get Name and Description data from external database

open
nobody
None
1
2012-11-12
2012-10-23
Anonymous
No

When I create a new entry, I would like to see into the Nane field, a
drop-down list of data names of people form another external database.

And when I select a person of this list, get into the description
field the full data of this person.

Has anyone done this implementation or similar?

Thanks.
Robert.

Discussion

  • I'm not aware of anybody having done this, but it wouldn't be too difficult to do given some knowledge of PHP.

    Campbell

     
  • I've now (SVN Rev 2534) allowed the name field to be am autocomplete datalist by specifying an array of options in $datalist_options['entry.name'] in the config file. At the same time I've changed the way that the autocomplete fields work so that they now use HTML5 elements if supported by the browser, otherwise falling back to the jQuery UI Autocomplete widget.

    Campbell

     
  • knjigor
    knjigor
    2012-10-29

    This is an excellent upgrade, just what I needed, the only problem is that after the configuration I can't save the entry. Is there any possibility to apply this to custom fields in entry table?

     
  • (1) Not quite sure what you mean by "can't save the entry"? Do you mean you can't save the booking? If so, what is the error you are getting? Or do you mean something else?
    (2) Yes, I'll extend it to custom fields in the next couple of days

    Campbell

     
  • knjigor
    knjigor
    2012-10-29

    Can't save booking, because save button isn't working, and i'm not getting any errors. (Currently i'm running mrbs in localhost at latest wamp server)

     
  • Did you upload all the files from the web directory - not just the ones changed in that revision? There have been lots of changes recently and it may be that you've got an inconsistent set of files.

    Campbell

     
  • knjigor
    knjigor
    2012-10-29

    Thanx for tip, that solved problem.

     
  • I've now (Rev 2539) extended support for $datalist_options to the custom fields

     
  • knjigor
    knjigor
    2012-10-29

    Hi, I have just check this, and there seems to be a problem, only entry.name is affected with $select_options or $datalist_options no other fields aren't changed they are text boxes when i'm making a booking no matter what i change input to at config.inc.php or systemdefaults.inc.php.

     
    Last edit: knjigor 2012-10-29
  • I assume you have the key to $select_options or $datalist_options set to match your custom field name? Eg if your custom field name is 'catering' you should be defining

    $datalist_options['entry.catering'] = array('coffee', 'tea', 'sandwiches');
    

    The other thing to check is the type of your custom field. If it's a VARCHAR(N) then you'll just get a <textarea> box if N>$text_input_max. You can either change N or else change $text_input_max, which is a config setting and by default is 70. (The thinking here is that if you have a field which can take very long strings, then it's likely that a <textarea> is going to be more suitable for inputting data than an ordinary <input>, <select> or <datalist>).

    Campbell

     

  • Anonymous
    2012-10-30

    Yeah, I got it and was able to solve it.

    But there is another problem, when booking, you can not change the length of the booking or the beginning (if you click on the 7:00 it is impossible to put in the entry 10:00 as start. Actually it is possible to mark entry but in the database it is 7:00) Also, I noticed that the changes in the reservation that are related to the time are not saved to db for some reason. I have changed my resolution to 90 minutes if that matters.

     
  • OK - I can reproduce the problem. I'll take a look tomorrow.

    Campbell

     
  • I've now fixed this in Rev 2545.

    Campbell

     

  • Anonymous
    2012-10-30

    Works excelent

     
    Last edit: knjigor 2012-10-30
  • knjigor
    knjigor
    2012-10-31

    Ok, here is another problem, When I try to run reports, content of custom fields that are defined as $datalist_options is not showing in dropdown menu and isn't listed when you type first letters, but content in fields that are defined as $select_options works fine.

     
    Last edit: knjigor 2012-10-31
  • Thanks for spotting that. Now fixed in Rev 2547.

    Campbell

     
  • knjigor
    knjigor
    2012-10-31

    No prob, thanx for greate support

    Knjigor

     
  • knjigor
    knjigor
    2012-11-05

    I was looking at this feature and I have two suggestions to make it better:
    1. would it possible to configure multi select dropdown
    2. What about setting conditions for groups and fields (lets say we have departments that consists of teachers that have courses, and when we select course or department we only have teachers that are on that course or department - This is related to the previous proposal) something like area/room relation that is working at edit entry page and was working at report page (at least for me before updating from svn, now area and room aren't related in edit entry page)

    I think that this might be useful, but i think that maby it should be done trough db not config file

     
    Last edit: knjigor 2012-11-05
      1. No, not the way it's currently implemented. You can't set a "multiple" attribute when using the <datalist> element. You could have a multiple <select>, but that's going to get complicated when you try and enter the values in the database. An example of how you would use this feature in practice would help.

      2. I'm not sure I understand what you're looking for here. Are you looking for the ability to specify custom fields where the options for a custom field depend on the selected value of another custom field? Again, a use case would be useful.

      3. Area/room relation not working. Do you mean that when you change the area the list of rooms is not changing? It's working OK for me. What Revision are you using? Are you seeing any errors in the JavaScript console?

      Campbell

       
      Last edit: Campbell Morrison 2012-11-05
      • knjigor
        knjigor
        2012-11-13

        Practical use of multiselect would be for example:

        If we have for example one meeting (custom field 1 - 5 types) and we have 10 groups of attenders (custom field 2 - 10 types), and at every meeting there is one group, but sometimes we wont two or more groups to attend same meeting at same time so in that case there should be a multiselect option at custom field 2 because when attenders list they schedule from report page they won't see group meeting if we put it in field like description.

         
  • knjigor
    knjigor
    2012-11-05

    1. example: we have 17 departments at our Faculty, at department for English studies there is course English as second language for students from other departments, so when have to made reservation for that class i have to select two or three departments.

    2. Yes that's it, just like area/room working, as I said we have departments, teachers and courses, so when i select department for English studies i get teachers from that department and courses.

    3. I'm using 1.4.9 r2551 it isn't working in report page, no matter what area i select, i get all rooms listed.

    I realize that this is very complicated, but these are just my thoughts, not something that must be done :)

     
    Last edit: knjigor 2012-11-06
  • knjigor
    knjigor
    2012-11-12

    Ok, what about just multiselect for custom fields, not for $datalist_options but just for $select? Or something like jQuery UI MultiSelect Widget

     
    Last edit: knjigor 2012-11-12


Anonymous


Cancel   Add attachments