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

Question

Question

Address block field label rename and hiding country not working in Form version 11

asked on October 2, 2023 Show version history

Need help with the JS code that is not working on Version 11.

We have a an existing form created in version 10 After upgraded to version 11, I used  Convert (&duplicate ) feature in order to benefit from the features of new version. 

Address block on the form did not have any CSS or JS code for changing labels or hiding Country, but now we need both; also, we would like to keep it that way when saved to repository.

I found couple of code samples in the LF Answers, that was working in one of another form, but the same code is not working on the new form.

Current Form has a Different Mailing Address (Yes/No)  field and a rule, the address block shows if the answer is Yes.

This example in the Admin Guide is not working.

$(".State").siblings().text('State');           // (1) 

... tried following with single quote; 

$('.State').siblings().text('State /Region');            // (2) 

... tried these in a different format

$('#Field192_DSG3').siblings().text('State');            // (3) 

$("#q192 input[id*=_DSG3]").siblings().text("State");    // (4)

$("mailingAddress.State").siblings().text('State');   // (5)

 

Also tried hiding Country with a default value, but nothing here worked:  

// (5) 

$("mailingAddress.State").val("VA");
$(".Country").parent().children().val("USA");
$(".Country").parent().children().css('display', 'none');

I ended up creating a new form, added the address block only without any rule, and tried  (6)  above, which still works well in a form (version 10), but it doesn't work on the new form. What is wrong,? Is it server related issue?

0 0

Answer

SELECTED ANSWER
replied on October 2, 2023 Show version history

Unfortunately, how Javascript works in the Modern designer is very different from how it works in the Classic designer, so any code examples created for the Classic designer will not carry over to the Modern designer.  

Specifically, the differences here are the code examples you are using are utilizing JQuery, which is not used in the Modern designer, and it is directly addressing the field components, which the Modern designer does not allow either (the Modern designer runs the Javascript in a Sandboxed iFrame and can only impact field components via the LFForm interface - see instructions in the help files).

Personally, I choose not to utilize the built-in address block in the new designer, opting instead for stand-alone single-line fields, which I can control in more detail.  There is a discussion on this other post that addresses several of the concerns and limitations of the built-in address block.

1 0

Replies

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

Sign in to reply to this post.