#Why is this form submit on child component not workining with "globalAction$"

2 messages · Page 1 of 1 (latest)

wind brook
#

What am i doing wrong here. When clicking on submit i am getting this error in console: ndex):12838 Not allowed to load local resource: file:///C:/.../src/components/regis-form/regis-form.tsx:36:7
d

This my component setup:

export const useRegSubmit = globalAction$((requestEvent: any) => {

console.log('requestEvent: ', requestEvent);

return {
success: 'success'
}
});

export default component$(() => {
const action = useRegSubmit();

useTask$(({ track }) => {
track(() => [action.value?.success]);

if(action.value?.success){
  console.log('form submitted successfully!');
}

});

return (
<Form preventdefault:submit action={action} >
<input type="text" name="phonenumber" />
<button type="submit">SEND</button>
</Form>
);
});

cunning nebula
#

Copying this code to a new qwik project works for me, so the issue must be somewhere else.