Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefill of gender value in new settings will be ignored #486

Open
mediaessenz opened this issue Mar 27, 2023 · 1 comment
Open

Prefill of gender value in new settings will be ignored #486

mediaessenz opened this issue Mar 27, 2023 · 1 comment
Milestone

Comments

@mediaessenz
Copy link
Contributor

plugin.tx_femanager.settings.new.prefill {
    gender = TEXT
    gender.value = 2
}

has no effect of the gender radio boxes in the register new user form.

Always the radio element with value 0 (male) will be checked, independent of the defined prefill value.

The user object, which is used to compare the value inside the corresponding gender partial is null.

@mediaessenz
Copy link
Contributor Author

As a temporary workaround for an installation, where I use gender value 2 for a neutral salutation, which should be the default in this case, I changed the gender partial this way:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
	  xmlns:femanager="http://typo3.org/ns/In2code/Femanager/ViewHelpers"
	  data-namespace-typo3-fluid="true">

<div class="femanager_fieldset femanager_gender form-group">
	<label class="control-label">
		<f:translate key="tx_femanager_domain_model_user.gender" />
		<f:if condition="{femanager:Validation.IsRequiredField(fieldName:'gender')}">
			<span>*</span>
		</f:if>
	</label>
	<div class="form-check-inline">
		<div class="radio">
			<label>
				<f:form.radio
					id="femanager_field_gender1"
					property="gender"
					value="1"
					checked="{user.gender} == 1"
					additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'gender')}" />
				<f:translate key="tx_femanager_domain_model_user.gender.item1" />
			</label>
		</div>
		<div class="radio">
			<label>
				<f:form.radio
					id="femanager_field_gender0"
					property="gender"
					value="0"
					checked="{user} && {user.gender} == 0"
					additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'gender')}" />
				<f:translate key="tx_femanager_domain_model_user.gender.item0" />
			</label>
		</div>
		<div class="radio">
			<label>
				<f:form.radio
					id="femanager_field_gender2"
					property="gender"
					value="2"
					checked="!{user} || {user} == 2"
					additionalAttributes="{femanager:Validation.FormValidationData(settings:settings,fieldName:'gender')}" />
				<f:translate key="tx_femanager_domain_model_user.gender.item2" />
			</label>
		</div>
	</div>
</div>
</html>

@sbusemann sbusemann added this to the 13.0 milestone Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants