Alpha Video Training
Results 1 to 5 of 5

Thread: (help) change return value 'undefined' in FormView field using lookup

  1. #1
    Member
    Real Name
    Marlon Rotty
    Join Date
    Aug 2014
    Location
    Semarang, Indonesia
    Posts
    5

    Default (help) change return value 'undefined' in FormView field using lookup

    I build a formview with lookup value in every field because I want to display name value rather than id value (data source is numeric type)
    12-09-2019_215648_CaptureImage.jpg

    my problem is when the data source value is empty, it looks like the lookup will return with 'undefined' as a value.
    how to make the field display no value or still empty instead of undefined? it that possible?
    12-09-2019_215604_CaptureImage.jpg

  2. #2
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,297

    Default Re: (help) change return value 'undefined' in FormView field using lookup

    please send a test case and we will show you how to do it, or if it is not possible now, we can add a feature to the formview to make it possible

  3. #3
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,297

    Default Re: (help) change return value 'undefined' in FormView field using lookup

    Quote Originally Posted by Selwyn Rabins View Post
    please send a test case and we will show you how to do it, or if it is not possible now, we can add a feature to the formview to make it possible
    thanks for sending in your test case
    we have made a change to the way lookups are implemented in the FormView.
    in your case, you have a lookup field, that is empty (in your case the lookup value appears to be "0" for the missing data) and currently the lookup logic returns 'undefined' if a lookup match was not found.
    the change we made is that if the lookup field is empty we now return a value of blank (rather than undefined).
    undefined is now only returned if the lookup value is not empty and the lookup source does not have a match

    however, you can get the result you want with the existing build you are using by changing the lookup type to "function" (from the current setting of "list")
    once you do this you have complete control over how the lookup works.
    here is a sample of how you might define the lookup function for one of your lookups

    function lookup3(data) {
    if(data == 0) return '';
    var _d = {dialog.object}.getControl('listcaptain')
    for(var i = 0; i < _d.lenth; i++) {
    if(_d[i].ID == data) return _d[i].Fullname

    }

    return 'undefined'

    }

  4. #4
    Member
    Real Name
    Marlon Rotty
    Join Date
    Aug 2014
    Location
    Semarang, Indonesia
    Posts
    5

    Default Re: (help) change return value 'undefined' in FormView field using lookup

    Glad to hear this feature will be in the next build, will more helpful and easier if this function is set in the lookup properties. Thank you very much Selwyn!

  5. #5
    Alpha Software Employee Selwyn Rabins's Avatar
    Real Name
    Selwyn Rabins
    Join Date
    Mar 2000
    Location
    Boston, MA
    Posts
    5,297

    Default Re: (help) change return value 'undefined' in FormView field using lookup

    i am afraid i don't understand the point you are making. the lookup feature offers two options. 1) use a list as the lookup source or 2) a custom option where you can write you own javascript function and completely control how the lookup is performed and what data is returned by the lookup.

    are you saying that if you choose the custom option you would like to be able to define the custom javascript function in the form builder ? if so, then you can. the form builder has a "javascript" tab.

Similar Threads

  1. How to change tabIndex in a freeform formview layout?
    By cptutrecht in forum Tablet-Optimized Form Capabilities Beta
    Replies: 1
    Last Post: 09-19-2017, 07:00 PM
  2. Field validation javascript in Formview not firing if value is null/undefined
    By dougeven in forum Tablet-Optimized Form Capabilities Beta
    Replies: 6
    Last Post: 10-09-2015, 03:08 PM
  3. The lookup field does not return the data.
    By MikeData in forum Application Server Version 9 - Web/Browser Applications
    Replies: 28
    Last Post: 02-25-2009, 09:38 PM
  4. Lookup says 'undefined'
    By Pat Bremkamp in forum Application Server Version 8
    Replies: 3
    Last Post: 05-14-2007, 11:49 AM
  5. Change field rule Lookup?
    By Keith Hubert in forum Alpha Five Version 5
    Replies: 6
    Last Post: 05-27-2003, 03:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •