forms to include FE facing only
This commit is contained in:
@@ -4,6 +4,7 @@ import { useRouter } from "next/router";
|
||||
import useTranslation from "next-translate/useTranslation";
|
||||
import xpath from "xpath";
|
||||
import BuildField from "./buildfield";
|
||||
import jsonpath from "jsonpath";
|
||||
|
||||
export default function BuildRow(props) {
|
||||
let { t } = useTranslation();
|
||||
@@ -11,7 +12,13 @@ export default function BuildRow(props) {
|
||||
const router = useRouter();
|
||||
const { locale } = router;
|
||||
|
||||
const { rowXML, whichSection, sectionCount, onSubmit } = props;
|
||||
const {
|
||||
rowXML,
|
||||
whichSection,
|
||||
sectionCount,
|
||||
onSubmit,
|
||||
mandatoryFieldsData,
|
||||
} = props;
|
||||
|
||||
const parser = new DOMParser();
|
||||
|
||||
@@ -28,18 +35,31 @@ export default function BuildRow(props) {
|
||||
var rows = xpath.select("//label/@description", doc);
|
||||
var fieldtype = xpath.select("//@classid", doc);
|
||||
var datafieldname = xpath.select("//@datafieldname", doc);
|
||||
return (
|
||||
<BuildField
|
||||
fieldType={fieldtype[0].value}
|
||||
label={rows[0].value}
|
||||
datafieldname={datafieldname[0].value}
|
||||
key={key}
|
||||
props={props}
|
||||
picklistData={
|
||||
props.props.props.formData.pickListData
|
||||
}
|
||||
/>
|
||||
|
||||
const isRequiredField = jsonpath.query(
|
||||
mandatoryFieldsData,
|
||||
"$..value[?(@.LogicalName=='" +
|
||||
datafieldname[0].value +
|
||||
"')]"
|
||||
);
|
||||
|
||||
if (isRequiredField[0].RequiredLevel.Value != "None") {
|
||||
return (
|
||||
<BuildField
|
||||
fieldType={fieldtype[0].value}
|
||||
label={rows[0].value}
|
||||
datafieldname={datafieldname[0].value}
|
||||
key={key}
|
||||
props={props}
|
||||
picklistData={
|
||||
props.props.props.formData.pickListData
|
||||
}
|
||||
mandatoryFieldsData={mandatoryFieldsData}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
})}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user