struct CustomerArgs {
customer: String,
hours: u64,
room: String,
items: [String; 5],
}
#[component]
pub fn App() -> impl IntoView {
fn update_values(customer: String, hours: u64, room: String, items: [String; 5]) {
}
view! {
<main class="container">
<p>"Bir isim ve saat giriniz."</p>
<form class="column" action="">
<input
id="customer-input"
placeholder="Isim girin."
/>
<input
id="time-input"
placeholder="Bir Saat girin"
/>
<input
id="items-input"
placeholder="Alına mallar."
/>
<select class="selector" name="rooms" id="rooms">
<option value="placeholder" selected hidden disabled>otağ seç</option>
<option value="mexico">mexico</option>
<option value="baku">baku</option>
<option value="green">green</option>
<option value="istanbul">istanbul</option>
<option value="vip">vip</option>
</select>
<button class="submit" type="submit">"Ekle"</button>
</form>
<div class="col">
<table class="tbl">
<tr>
<th>Ad</th>
<th>Saat</th>
<th>Borc</th>
<th>Ödenilib</th>
<th>Düzenle</th>
</tr>
<tr>
<td>Deniz</td>
<td>4 Saat (Green Room)</td>
<td>AZN 20</td>
<td>Yox</td>
<td class="buttonin">
<button class="btn">
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
</button>
</td>
</tr>
<tr>
<td>Tural</td>
<td>4 Saat (Mexico)</td>
<td>AZN 16</td>
<td>Yox</td>
<td class="buttonin">
<button class="btn">
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
</button>
</td>
</tr>
</table>
</div>
</main>
}
}
#pass the input values from html to a function to save it as a JSON
44 messages · Page 1 of 1 (latest)
What's the issue?
are u using leptos?
i want to take the inputs from these inputs, then i wanna pass them to a JSON using the struct i made there
What do you mean by "pass them to a JSON"
save them in somewhere
perferably a json
or a database
but first i gotta know how to make a json out of these input's
inputs*
(which i don't)
Put them in a struct then use serde_json::to_string
mate there is already a struct, i don't know how to pass TAKE them from the inputs in HTML and pass it to the rust code
yes leptos and tauri
use leptos::*;
use serde::{Deserialize, Serialize};
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(js_namespace = ["window", "__TAURI__", "tauri"])]
async fn invoke(cmd: &str, args: JsValue) -> JsValue;
}
#[derive(Serialize, Deserialize)]
struct CustomerArgs {
customer: String,
hours: u64,
room: String,
items: [String; 5],
}
#[component]
pub fn App() -> impl IntoView {
fn update_values(customer: String, hours: u64, room: String, items: [String; 5]) {
}
view! {
<main class="container">
<p>"Bir isim ve saat giriniz."</p>
<form class="column" action="">
<input
id="customer-input"
placeholder="Isim girin."
/>
<input
id="time-input"
placeholder="Bir Saat girin"
/>
<input
id="items-input"
placeholder="Alına mallar."
/>
<select class="selector" name="rooms" id="rooms">
<option value="placeholder" selected hidden disabled>otağ seç</option>
<option value="mexico">mexico</option>
<option value="baku">baku</option>
<option value="green">green</option>
<option value="istanbul">istanbul</option>
<option value="vip">vip</option>
</select>
<button class="submit" type="submit">"Ekle"</button>
</form>
<div class="col">
<table class="tbl">
<tr>
<th>Ad</th>
<th>Saat</th>
<th>Borc</th>
<th>Ödenilib</th>
<th>Düzenle</th>
</tr>
<tr>
<td>Deniz</td>
<td>4 Saat (Green Room)</td>
<td>AZN 20</td>
<td>Yox</td>
<td class="buttonin">
<button class="btn">
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
</button>
</td>
</tr>
<tr>
<td>Tural</td>
<td>4 Saat (Mexico)</td>
<td>AZN 16</td>
<td>Yox</td>
<td class="buttonin">
<button class="btn">
<svg xmlns="http://www.w3.org/2000/svg" width="1.5em" height="1.5em" viewBox="0 0 24 24"><path fill="currentColor" d="M3 21v-4.25L16.2 3.575q.3-.275.663-.425t.762-.15t.775.15t.65.45L20.425 5q.3.275.438.65T21 6.4q0 .4-.137.763t-.438.662L7.25 21zM17.6 7.8L19 6.4L17.6 5l-1.4 1.4z"/></svg>
</button>
</td>
</tr>
</table>
</div>
</main>
}
}
this is the whole code
That's not helpful
oh sorry
what did they say
its gone
I would assume https://book.leptos.dev/view/05_forms.html to be helpful, I haven't ever used leptos so have no idea how it's input system works, and from these docs I don't have the brain capacity at the moment to understand it
Looks like you write a closure in the view macro
i don't get it
To be completely honest neither do I from my skimming of the docs
i've been stuck for a week now 😭
My hate of super macros grows by the day
try different solution
different approach to the problem
what different soltuion
not like we found a solution that we're sweitching it to another one
we don't know how to fix it
or i don't atleast
HELL noh.
this wont help but here is a ferris to cheer u up 
@tardy prairie @limpid marsh doesn't this crate has a method like this
i go to it's crates.rs page and it has the method
yea this shit just made my code 10 times worse
Did you enable the feature for it?
its like this rn