16

We are using the WFFM module with a custom save action.

Now, running through the AdaptedResultList we can access the fields with data. In this field set there is a property called FieldName. In my developer environment this follows the language the form is submitted in. But in the production environment it takes the language of the last updated version of the form.

What should I do to get the form name in a language-consistent way? The overall problem is that the language of FieldName changes in an unpredictable way.

9
  • Just to confirm do you have multiple languages present in production? Are these present on your developer machine also?
    – Anicho
    Oct 12 '16 at 11:14
  • Yes: The form exists in both danish and english.
    – Mads Buch
    Oct 12 '16 at 11:29
  • Which version of the module and version of sitecore you on?
    – Anicho
    Oct 12 '16 at 12:03
  • Everything is in version 8.1
    – Mads Buch
    Oct 12 '16 at 13:01
  • Can you clarify, not really clear what is the problem in your question. Oct 12 '16 at 14:29
4

I have seen the same behavior - what I concluded out of some tests is that WFFM is taking the "title" of the field in which the form was first requested. After that, it will stay in that language until the site restarts. WFFM caches some stuff it should not, and I assume this is one of those. We've had other issues with translations in WFFM due to the same phenomenon (in error reporting).

So, as that actually could not really be fixed in our version and we could not wait for a patch, we used the fieldID property instead like this:

var fieldItem = Sitecore.Context.Database.GetItem(new ID(field.FieldID));
// use fieldItem.Name

We continued with the fieldItem.Name which is the actual name of the field item in Sitecore - this will not change when switching languages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.