Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • 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
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(