I would approach this slightly differently.
I would create a custom form component called "Culture Code" or something.
In the view for this form component, I would either render a hidden field (to store the value only) or a text box if you want to display to the visitor.
Then in the C# code you could override the GetValue
method to grab the document culture from the current page (maybe by injecting IPageDataContextRetriever
):
private readonly IPageDataContextRetriever _pageDataRetriever;
public CultureCodeFieldFormComponent(IPageDataContextRetriever pageDataRetriever)
{
_pageDataRetriever = pageDataRetriever;
}
public override string GetValue()
{
var currentPage = _pageDataRetriever.Retrieve<TreeNode>().Page;
return currentPage.DocumentCulture;
}
Then when you add this to a Form, it should use the page context to drive the value of the field.