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

Question

Question

How to use Javascript to combine input information in another field.

asked on July 23, 2020

Good Morning,

I have an issue that I hope someone can help me with.  Here is my problem.  When a well construction form is submitted they have to choose the type of well they are constructing and if they choose "well > 100,000 GPD and is in one of the 15 counties, I need to show a message that says, "The selected county is within the Central Coastal Plain Capacity Use Area.  Please reference your Capacity Use Water Withdrawal Permit Number (CUxxxx) in Section 2. above."

My first thought was to use field rules but that did not work.  Then I thought about using JavaScript but that is not in my wheel house of knowledge. I had the idea that if I could combine the information into a text field "Well type -  County" and then I could use the field rules to show the message. 

I am hoping someone has already had to do this and would be willing to share their knowledge with me.

Bev

0 0

Answer

SELECTED ANSWER
replied on July 23, 2020

Actually you technically don't even need the IF wrappers...

InRestrictedCounty = OR(county=county1,county=county2...) will set that to either TRUE or FALSE

ShowMessage = AND(WellSize>100000,InRestrictedCounty) will need both of those to be TRUE then will set ShowMessage to TRUE which you can use for your field rule. Either way should work. 

1 0

Replies

replied on July 23, 2020

You could try using a formula in a few hidden fields to do your calculation, then field rules on top of that. Include two hidden fields (InRestrictedCounty and ShowMessage) set to save the data when hidden. 

For InRestrictedCounty, use a formula like

=if(OR(county=county1,county=county2,county=county3...),"Yes","No")

This should fill the field with Yes if county is set to a restricted county and No otherwise. 

Then you can use another hidden field for ShowMessage

=if(and(WellSize>100000, InRestrictedCounty = "Yes"),True,False)

If well size is greater than 100k and it's in a restricted county, this hidden field will be set to True, otherwise it will be set to false. NOW you can use a field rule, if ShowMessage is set to True, show an HTML field with the message you specify. 

1 0
SELECTED ANSWER
replied on July 23, 2020

Actually you technically don't even need the IF wrappers...

InRestrictedCounty = OR(county=county1,county=county2...) will set that to either TRUE or FALSE

ShowMessage = AND(WellSize>100000,InRestrictedCounty) will need both of those to be TRUE then will set ShowMessage to TRUE which you can use for your field rule. Either way should work. 

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

Sign in to reply to this post.