Comments (12)
This should be fixed with c33dcb6
from patternfly-yew.
Yup, IIRC that was fixed just recently. One of the buttons was missing the type="button"
attribute.
from patternfly-yew.
Ah no, same issue I guess, but different component: #42
from patternfly-yew.
There should be a fix on main
(which uses PF5 now) or on release-0.4.x
(for PF4).
from patternfly-yew.
I have been migrating and I am having to change lots of things. I am not sure if SubmitEvent
not actually works.
For Example:
let onsubmit = {
let local_errors = local_errors;
let (state, dispatch) = (login_state.clone(), dispatch);
Callback::from(move |event: SubmitEvent| {
event.prevent_default();
let state = state.clone();
let local_errors = local_errors.clone();
let (email, password, dispatch) = (
state.email.clone(),
state.password.clone(),
dispatch.clone(),
);
wasm_bindgen_futures::spawn_local(async move {
let response = login(&email, &password).await;
let local_errors = local_errors.clone();
match response {
Ok(response) => {
// FIXME: set cookie
redirect_page("/pages/display".to_string());
}
Err(err) => {
// web_sys::console::log_1(&JsValue::from_str(&err.description.to_string()));
let mut data = local_errors.deref().clone();
data.message = err.message.clone();
data.description = err.description.clone();
local_errors.set(data);
}
}
})
})
};
html! {
<>
<Background />
{error_handler}
<Login>
<LoginMain>
<LoginMainHeader title={title} description="Enter Credentials to login to your account"/>
<LoginMainBody>
<Form onsubmit={onsubmit}>
<FormGroup label="Email">
<TextInput
required=true name="email" r#type={TextInputType::Email}
value={(*login_state.email).to_string().clone()}
onchange={oninput_email} />
</FormGroup>
<FormGroup label="Password">
<TextInput
required=true name="password" r#type={TextInputType::Password}
value={(*login_state.password).to_string().clone()}
onchange={oninput_password}/>
</FormGroup>
<ActionGroup>
<Button label="log in" r#type={ButtonType::Submit} variant={ButtonVariant::Primary} />
</ActionGroup>
</Form>
</LoginMainBody>
<LoginMainFooter links={links} ></LoginMainFooter>
</LoginMain>
</Login>
</>
}
from patternfly-yew.
I have been migrating and I am having to change lots of things.
Have you seen this document? Feel free to add or file an issue for anything you think might be missing!
from patternfly-yew.
@phill-85 thanks, but I managed to migrate most of the things, there is just an issue with OnSubmit
from patternfly-yew.
there is just an issue with
OnSubmit
What's the issue?
from patternfly-yew.
when the "log in" button is clicked, the onsubmit callback is not triggered. I could be missing something, but I have checked and rechecked
I have been migrating and I am having to change lots of things. I am not sure if
SubmitEvent
not actually works. For Example:let onsubmit = { let local_errors = local_errors; let (state, dispatch) = (login_state.clone(), dispatch); Callback::from(move |event: SubmitEvent| { event.prevent_default(); let state = state.clone(); let local_errors = local_errors.clone(); let (email, password, dispatch) = ( state.email.clone(), state.password.clone(), dispatch.clone(), ); wasm_bindgen_futures::spawn_local(async move { let response = login(&email, &password).await; let local_errors = local_errors.clone(); match response { Ok(response) => { // FIXME: set cookie redirect_page("/pages/display".to_string()); } Err(err) => { // web_sys::console::log_1(&JsValue::from_str(&err.description.to_string())); let mut data = local_errors.deref().clone(); data.message = err.message.clone(); data.description = err.description.clone(); local_errors.set(data); } } }) }) }; html! { <> <Background /> {error_handler} <Login> <LoginMain> <LoginMainHeader title={title} description="Enter Credentials to login to your account"/> <LoginMainBody> <Form onsubmit={onsubmit}> <FormGroup label="Email"> <TextInput required=true name="email" r#type={TextInputType::Email} value={(*login_state.email).to_string().clone()} onchange={oninput_email} /> </FormGroup> <FormGroup label="Password"> <TextInput required=true name="password" r#type={TextInputType::Password} value={(*login_state.password).to_string().clone()} onchange={oninput_password}/> </FormGroup> <ActionGroup> <Button label="log in" r#type={ButtonType::Submit} variant={ButtonVariant::Primary} /> </ActionGroup> </Form> </LoginMainBody> <LoginMainFooter links={links} ></LoginMainFooter> </LoginMain> </Login> </> }
from patternfly-yew.
when the "log in" button is clicked, the onsubmit callback is not triggered. I could be missing something, but I have checked and rechecked
I have been migrating and I am having to change lots of things. I am not sure if
SubmitEvent
not actually works. For Example:let onsubmit = { let local_errors = local_errors; let (state, dispatch) = (login_state.clone(), dispatch); Callback::from(move |event: SubmitEvent| { event.prevent_default(); let state = state.clone(); let local_errors = local_errors.clone(); let (email, password, dispatch) = ( state.email.clone(), state.password.clone(), dispatch.clone(), ); wasm_bindgen_futures::spawn_local(async move { let response = login(&email, &password).await; let local_errors = local_errors.clone(); match response { Ok(response) => { // FIXME: set cookie redirect_page("/pages/display".to_string()); } Err(err) => { // web_sys::console::log_1(&JsValue::from_str(&err.description.to_string())); let mut data = local_errors.deref().clone(); data.message = err.message.clone(); data.description = err.description.clone(); local_errors.set(data); } } }) }) }; html! { <> <Background /> {error_handler} <Login> <LoginMain> <LoginMainHeader title={title} description="Enter Credentials to login to your account"/> <LoginMainBody> <Form onsubmit={onsubmit}> <FormGroup label="Email"> <TextInput required=true name="email" r#type={TextInputType::Email} value={(*login_state.email).to_string().clone()} onchange={oninput_email} /> </FormGroup> <FormGroup label="Password"> <TextInput required=true name="password" r#type={TextInputType::Password} value={(*login_state.password).to_string().clone()} onchange={oninput_password}/> </FormGroup> <ActionGroup> <Button label="log in" r#type={ButtonType::Submit} variant={ButtonVariant::Primary} /> </ActionGroup> </Form> </LoginMainBody> <LoginMainFooter links={links} ></LoginMainFooter> </LoginMain> </Login> </> }
there is just an issue with
OnSubmit
What's the issue?
from patternfly-yew.
I think I can reproduce the issue. Need to check the cause and fix.
from patternfly-yew.
Yea, I think I know what the issue is. We started to use AttrValue
, as recommended by Yew. However using AttrValue
with a default will actually create an attribute with an empty string. Which caused some problems already, especially with the form
attribute. Which then points to a form with an empty ID. Which doesn't work.
Switching to Option<AttrValue>
solved this issue. And I guess we need to check all the places for exactly that.
from patternfly-yew.
Related Issues (20)
- Selectable cards always select the first one HOT 1
- NavRouterItem not working with yew_nested_router HOT 2
- [Discussion] `data-test` property on components HOT 4
- Constant ID updates HOT 1
- Rethink keys in tables HOT 3
- [Discussion] New Table implementation
- Dropdown menu doesn't close when clicking item
- Error: 'invalid attribute key' prevents some elements from rendering" HOT 3
- Provide an integration story for yew-icons
- [table]: Allow exanding rows, redrawing only the toggled row HOT 3
- Hover effects for clickable Cards HOT 1
- `UseStateHandle` created outside of a backdrop does not trigger a rerender inside the backdrop HOT 2
- [discussion] More advanced icon support HOT 6
- Keyboard navigation
- Info: Implemented components
- Callback/event handler signatures HOT 9
- [Discussion] Specification of SearchInput advanced search attribute parsing HOT 4
- Release 0.5.0 HOT 3
- [Disucssion] handling the "middle" truncation option HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.