Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Problem with the Return Value of Typeahead List

Greetings to the great osTicket Community! Thank you for accepting me in your Forum!

I have created a list of e-mails and I have set the Type of the respective field in the "Contact Information" form to this custom list.
I choose the "Typeahead" widget in the field setup and the list works perfectly but when I select a value from the list, the form doesn't seem to keep this value. That is, when I submit the form, a message: "field 'email' is required" appears and at the same time the selected value is on the field.

This problem is prevalent to all lists that use the "Typeahead" functionality. For example, when I configure the return email messages as an Administrator, when I use a variable with more options (e.g. %{company.name}) when I press the dot after "company", a Typeahead list appears with the available properties, but when I select one, it doesn't appear on the message. I have to type the whole variable and ignore the Typeahead list.

My installation:
osTicket Version: v1.10.1 (9ae093d)
Web Server
Apache/2.4.25 (Debian)
MySQL
10.1.26
PHP: 7.0.19-1

Thank you in advance for your help!

Comments

  • Hello again,

    it seems that the problem is not at the typeahead widget but during the creation of the  new user.
    The User Form posts the right, selected values from the typeahead lists (I debugged it with Firebug), but somewhere after the click on "Add User" the value of the "email" field becomes empty and is not inserted in the database (table: ost_user_email).

    Any ideas?

    Thank you in advance!

  • I've reported this thread to the devs.  While we wait for one of them to take a look can you provide a screen shot of your Contact Details form?
  • Thank you for your interested.
    In the following images I've prepared a short demo:
    1. I have created three custom lists:
    image

    2. I edited the Contact Details form and I connected the "Email" and "Name" fields to the respective lists and I set the fields as widget "Typeahead". I also added a field "Office" which I connected to the third list and I set it as widget "Drop Down".

    3. Then I tried to "Add a User":
    image
    4. The I clicked on "Add User":
    image

    5.The new user is missing "Email" and the Response is:
    image

    6...while the Post of the Contact Detail form seems OK:
    image

    7. and the status of the new User in the User Directory is:
    image

    Thank you in advance!





  • I repeat the post due to problems with the images:

    1. I have created three custom lists:

    image

    2. I edited the Contact Details form and I connected the "Email" and "Name" fields to the respective lists and I set the fields as widget "Typeahead". I also added a field "Office" which I connected to the third list and I set it as widget "Drop Down".

    3. Then I tried to "Add a User":

    image

    4. The I clicked on "Add User":


    image

    5.The new user is missing "Email" and the Response is:


    image

    6...while the Post of the Contact Detail form seems OK:



    image


    7. and the status of the new User in the User Directory is:



    image


    Thank you in advance!
    user_lists.png
    960 x 312 - 21K
    user_form1.png
    648 x 332 - 16K
    user_form2.png
    647 x 334 - 14K
    user_form4.png
    975 x 506 - 38K
    user_form3.png
    983 x 692 - 51K
    user_Directory.png
    962 x 459 - 28K
  • is 111.gr a valid domain?

    Try going to:
    Admin panel -> Manage -> Formns -> Contact Details
    Email address -> Click Config.
    Change Validator to: None.
    Click Save,
  • They are test data, not a real domain.

    But, there is no "validator" property in the "email" field, as the "Type" of the field is a specific list (see image):


    image
    contact_info-form.png
    1155 x 578 - 52K
  • I've asked to devs to take a look at this.  I've never tried to do that... do I dont know if you have discovered a bug or if you are simply using the list in a way that wasn't intended and thats breaking things.  Have you setup the users with the same email addresses?
  • @ntozier @dkalleas It probably won't work with the email field as it's a built-in field and not supposed to be touched. 
  • In the production installation I use real domain emails, so the validation of the email addresses is not a problem.

    I have a discrete set of users and I want to make their lives easier by typing as few characters as possible while entering their email. I also want to protect myself from garbage emails, which are possible in a free text field. That's because I have created all the users as guests, as they always complain about too many credentials for them to remember.

    Thank you for your help!

  • I think I found the lines in the code where the value of the selected email is lost:

    File: /include/class.user.php
    Lines: 870 - 879

    class UserEmail extends UserEmailModel {
        static function ensure($address) {
            $email = static::lookup(array('address'=>$address));
            if (!$email) {
                $email = new static(array('address'=>$address));
                $email->save();
            }
            return $email;
        }
    }

    When I use plain textbox for "e-mail", the parameter $address is a string and everything works fine.

    When I use typeahead with a custom list for the "e-mail", the parameter $address is an array with the id of the list value and the list value itself.  I guess the command "new" returns empty email and the following "save" saves nothing to the database.

    To make things more bizarre:

    • The built in field "name" works fine with Widget type "Typeahead" and a custom list as a source (you could see it to the previous images I sent you)
    • When I change the widget of the "e-mail" to "DropDown", it works fine.
    Thank you!



  • ..correction:

    The "email" field has the same problematic behavior, even if it is a DropDown widget (when connected to a custom list).

    Thank you!
  • As @Kevinthejedi has said, "It probably won't work with the email field as it's a built-in field and not supposed to be touched. "

    That sorta means that you shouldn't mess with that built in field.
Sign In or Register to comment.