select drop down selected on reopen

This commit is contained in:
2024-10-10 11:30:02 +01:00
parent 4dc1e4f233
commit 113c39a7e9
2 changed files with 37 additions and 35 deletions
@@ -457,7 +457,7 @@ export const RenderPickList = ({
datafieldname,
name,
label,
input: { onChange, value },
input,
optionsArr,
meta: { touched, error },
errorMsg,
@@ -487,12 +487,12 @@ export const RenderPickList = ({
<div>
<select
// {...input}
{...input}
className="govuk-select "
id={datafieldname}
name={datafieldname}
id={name}
name={name}
disabled={custom.disabled}
onChange={onChange}
// onChange={onChange}
>
<option>{t("common:drop-down-select")}</option>
{Object.keys(optionsArr).map((key, index) => {
@@ -2,7 +2,7 @@ import { JSONPath as jsonpath } from "jsonpath-plus";
import useTranslation from "next-translate/useTranslation";
import { useRouter } from "next/router";
import { useDropzone } from "react-dropzone";
import { Field } from "redux-form";
import { Field, reduxForm, formValueSelector } from "redux-form";
import { getFormCollectionByID } from "../../../../components/utils";
import {
FileUploadField,
@@ -15,6 +15,8 @@ import {
RenderTextfield,
} from "../representationElements";
import { connect } from "react-redux";
let S78_Questionnaire = (props) => {
let { t } = useTranslation();
@@ -1043,37 +1045,37 @@ let S78_Questionnaire = (props) => {
);
};
export default S78_Questionnaire;
//export default S78_Questionnaire;
//const selector = formValueSelector("representationForm"); //<-- same as form name
const selector = formValueSelector("representationForm"); //<-- same as form name
// S78_Questionnaire = connect((state) => {
// const representationTypeValue = selector(state, "representationType");
// const procedureTypeValue = selector(state, "procedureType");
S78_Questionnaire = connect((state) => {
const representationTypeValue = selector(state, "representationType");
const procedureTypeValue = selector(state, "procedureType");
// return {
// procedureTypeValue,
// representationTypeValue,
// };
// })(S78_Questionnaire);
return {
procedureTypeValue,
representationTypeValue,
};
})(S78_Questionnaire);
//const mapStateToProps = (state, props) => {
// console.log();
// return {
// search: state.search,
// searchResultsObj: state.searchResultsObj,
// formData: state.formData,
// appealType: state.appealType,
// currentView: state.currentView,
// myRepresentations: state.myRepresentations,
// initialValues: state.currentView.caseReference.repDetails,
// };
// };
const mapStateToProps = (state, props) => {
console.log();
return {
search: state.search,
searchResultsObj: state.searchResultsObj,
formData: state.formData,
appealType: state.appealType,
currentView: state.currentView,
myRepresentations: state.myRepresentations,
initialValues: state.currentView.caseReference.repDetails,
};
};
// export default connect(mapStateToProps)(
// reduxForm({
// form: "representationForm",
// enableReinitialize: true,
// destroyOnUnmount: false,
// })(S78_Questionnaire)
// );
export default connect(mapStateToProps)(
reduxForm({
form: "representationForm",
enableReinitialize: true,
destroyOnUnmount: false,
})(S78_Questionnaire)
);