Merged PR 1262: select drop down selected on reopen

select drop down selected on reopen

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