Expand my Community achievements bar.

SOLVED

Drop down Value triggers fill able text field to appear.

Avatar

Level 2

Am back, I have a fill able form that I am very happy with but I still want to make some more improvements.

I want to be able to use my Drop Down list Values to trigger new windows

For example: If I have a drop down that asked for Title and the choices are CIV, MIL, CTR if they chose MIL I need to know what their rank is but if they choose CTR I need to know what company they work for.

So if they Chose CTR, to the right of the value I would like a text field box to appear saying Company name: _____ so they can fill it out.

I was able to find some info but it was design to have choices narrowed down I just need Fill able Text boxes to appear based on a drop down value selected.

Thanks again

1 Accepted Solution

Avatar

Correct answer by
Former Community Member

I created a sample for you ....the code is on the exit event of the DDList. In my case I used the same field to capture the additional info and simply modified the caption based on the value chosen. Let me what you think.

Paul

View solution in original post

13 Replies

Avatar

Correct answer by
Former Community Member

I created a sample for you ....the code is on the exit event of the DDList. In my case I used the same field to capture the additional info and simply modified the caption based on the value chosen. Let me what you think.

Paul

Avatar

Level 2

This is excalty what I needed.  I copied and used the java code to my ddlist and changed the TextField1 to match the text field am using which is TextField11, and I made Textfield11 invisable.  But for some reason it does not work.  Yours works really well, I will continue to compare your example to mine to see what I did wrong.

Thanks so muhc for your help!

Avatar

Level 2

That did it, man you guys are great.

Avatar

Level 2

This has worked really well, i have been able to clean up the form.  Only required fiels are shown and more apera

based on drop down values.

The only problem I am having now, is that when I use my submit java button the fields are all hiden, they need to enable java, and re click the drop down to make the fields show up again... The fields retain the data but they just dont show.

Avatar

Former Community Member

You may want to try adding the command xfa.layout.relayout() at the end of your code to force a screen refresh.

Paul

Avatar

Level 2

On my first drop down

if

(this.rawValue == "Transfer"){

email.presence

= "visible";

}

xfa.layout.relayout();

so added to the end like that above?  do i need to add ;

also will I need to do it to all of the drop downs with code?

Avatar

Former Community Member

Yes that is correct .....if you are changing the pressence then you can add the command. Yes you shoudl add a ; to the end

of the line.

Paul

Avatar

Level 2

I added the cmd to both ddlists, but after saving and reopening the fields are still hidden and I need to click the drop down again to reactivate them.

any ideas?

Thanks agian for your help

Avatar

Level 2

It apears to be working for 1 of the two drop downs.  I will try and see what is the differnce.

Thanks

**nevermind its not work on either DDlist

Avatar

Level 2

Would it be possible to make change to the preOpen java area or anther area other than exit?  Code done at exit so its looking for there to be a change.  Is there way to tell it to look on open and on exit?

Avatar

Former Community Member

Not sure I follow what you are asking ....you can move the code to whatever event that you want but recognize that thecode will only execute when that event fires. PreOpen is before the ddlist even opens so no selection is made ...that is too early. The Change event is probably not the best either as the user may pick something (the form adjusts) then they change their minds and pick something else. To me the exit event is the best event to use because the user has selected and is committed to that value.

Paul

Avatar

Level 2

Since am new i dont know what am doing... but I did play with diffent ones and it seems like Validate with some modification to the code is doing what i want it to do.

Now i can save the file and when I open it it automaic shows the hidden fieds that sould show.

I have an e-mail button with java code, I made a copy and changed who it emails to, but when you click one button it wants to use both. Im so close to finish this lol.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----