Get 2024 Templates Mega Bundle!$1000 worth of 19 Bootstrap HTML, Vue & React Templates + 3 Vector Sets for just $99
Get for 99$

How to set Horizontal wizards input ref formData value from vuex store in onMounted ?


After the network request set the initial value of ref formData from onMounted method not working? It printed but step1 component input value was not changed. We are using vue3 template
How to change input value in this situation?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Hi,

Could you please attach a code that shows how you are setting formData?



setup() {
const store = useStore();
const _stepperObj = ref<StepperComponent | null>(null);
const horizontalWizardRef = ref<HTMLElement | null>(null);
const currentStepIndex = ref(0);
const currentScreening = computed(() => {
return store.getters.currentScreening;
});
const formData = ref<CreateAccount>({
question1:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question1
? "1"
: "0",
question2:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question2
? "1"
: "0",
question3:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question3
? "1"
: "0",
question4_1:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question4[0].isChecked
? "1"
: "0",
question4_2:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question4[1].isChecked
? "1"
: "0",
question4_3:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question4[2].isChecked
? "1"
: "0",
question4_4:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question4[3].isChecked
? "1"
: "0",
question4_5:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question4[4].isChecked
? "1"
: "0",
question4_6:
currentScreening.value.data !== undefined &&
currentScreening.value.data.question4[5].isChecked
? "1"
: "0",
researchTitle: "",
typeOfReview: "standard",
});
const key = ref(0);
onMounted(() => {
store.dispatch(Actions.GET_IRB_SCREENING).then(() => {
console.log("gg");
console.log(formData.value.question1);
console.log(formData.value.question2);
console.log("gg");
key.value += 1;
firstStep();
});
_stepperObj.value = StepperComponent.createInsance(
horizontalWizardRef.value as HTMLElement
);
setCurrentPageBreadcrumbs("New", ["IRB", "Applications"]);
});



It worked on launch from navigation but not working on refresh page or write route and enter



Hi,

Is currentScreening a data object which you are setting with action GET_IRB_SCREENING?

In this case, I think it is better to assign your formData object inside then(()=>{}) section. During an object initialization, it will always contain only your default value.


Your Support Matters!

We will highly appreciate your Metronic Review on Themeforest.
Please go to Themeforest Downloads page, select Metronic & leave your feedback.
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(