You are viewing limited content. For full access, please sign in.

Question

Question

Form dropdown list and lookup

asked on May 9, 2016

So we have a sort of "Edit" form.  Where based off a unique hidden ID we are pulling in a bunch of information out of a database.  We want the fields to pull the existing data, but also have a list of the choices and we cannot quite seem to get it.  For example, we are just testing a Race field.  We have a race table with choices.  When I hook it up to the dropdown in forms, everything is fine.

 

I also want to put what the existing race choice is when you are on the form for the person.  So if I key in the ID of a person who is White it auto populates as such (this works)

Now comes to the part where we want both.  We want the existing Race to show, but when they click the dropdown, only to show the choices from the table.  No matter the order we always seem to just get the existing Race with nothing in the dropdown:

Anyone know how we could accomplish this?  Again, basically it is an edit form.  Pull over the attributes of the person and be able to change them.  But only change them to values that are stored in a list.

Lookup Rules:

Then to a different view with no condition:

Thanks!

1 0

Answer

SELECTED ANSWER
replied on May 16, 2016

Custom JavaScript can help you in this case and you need two drop-down field A and B:

Use lookup to fill A with no condition, and add lookup rule to fill B when some conditions match;

Then add the following as custom JavaScript:

$('document').ready(function(){
  $('#FieldB').change(function() {
    $('#FieldA').val($('#FieldB').val());
  });
})

Replace A and B in the above script with your field ID.

And hide field B.

0 0
replied on May 16, 2016 Show version history

Great, thank you for the tip Rui, we really appreciate it.

0 0
replied on May 31, 2016 Show version history

Nevermind this post, we got it to work eventually with some SQL stored procedures

0 0
replied on August 14, 2020

How would I do this if my drop down field is within a table?

0 0

Replies

replied on May 9, 2016

I would probably discard the information you want them to update, or not pull it over. Anyway I think to do it (use a list, radio, ect.), I can't think of a way to force the user to select a DIFFERENT value (since there is already a value there) then what they already have in there. Good luck! I'd be interested to see if someone else has a better soultion.

0 0
replied on May 10, 2016

Thanks Richard.  We certainly dont want to force them to change.  Just pull over the existing information.  The information pulled is going to be one of the values in the list since it came from the list to begin with.  We just want to give them the option to change it.  Right now we have to go the route of an old field and new field.  So:

Current:  Display Race

New Race:  They pick from the list or leave it blank.

 

Then when the workflow runs though we have to check every field.  If the new field is empty, use the current field.  Have to do that check for all fields and thats not good.  

Hopefully there is a solution out there.

0 0
replied on May 10, 2016

The race drop down from above, is that being pulled from a DB into the list, or was that a copy/paste job?

If it's pulled from a DB, why not import the 'oldrace' into a hidden field, then do a lookup on your DB. So, your 'oldrace' looks to the 'racetable' for the 'newrace' drop down.

0 0
replied on May 10, 2016

Tried that too (unless I am misreading).  We have tried to pass the current Race to a hidden field. Then put it into the drop down but also have the drop down tied to the stand list of races.  Does not seem to work. 

Tried it with another field too.  Relationship to Veteran.

There is a list in a DB that describes the options (child, spouse, foster child, etc).  We have the field tied to the drop down list and it works.

However, when we want to populate that field with something and then just have the list as well (the value populated will always be from the list) get nothing.  To illustrate we did a hidden field called "Current Relationship" and just the normal "Relationship".

Keying in an ID automatically populates the hidden field with Adopted Child.  It also puts Adopted Child in the "Relationship" dropdown.  But, when I click the dropdown I do not get a list that is in the DB.

 

 

Where I want it to show

0 0
replied on May 10, 2016

I opened up my test server and did some test.

Anytime I had a 'lookup rule' pointed to a drop down menu, I was not able to change the option the other options didn't show up, exactly like yours. In conclusion, technically, it's working as designed, right?

If A = B, then B = A type of deal. Can't change B to C, since per the lookup rule, B = A.

What you could do, is use an open field, and copy/paste all of the options into auto-fill. Then run a WF at the finish to make sure you don't have any undesirable data, which is less then ideal.

The data for these unique ID's, are they in Laserfiche as meta data, or do they only exist in the DB?

 

 

0 0
replied on May 10, 2016

Yeah, they are in our templates and the database.  I have tried making the dropdown field a Text Field and tie that field to the SQL list.  If you do that you can click to get a drop down but that does not prevent users from typing.  Wondering if there is some JS we could use that prevents users from typing in the field but allows them to pick from the list.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.