Skip to main content

Posts

How to implement this using html and csss

I want to implement this, but can't find a way: I tried CSS grid but it wasn't working out, tried to think of how i would do it in flex box but still couldn't figure it out, so anyone who has done it before it would be helpful with code Via Active questions tagged javascript - Stack Overflow https://ift.tt/DA1eBNM

SvelteKit form checkboxes not accurately displaying checked state after form submission

I have a SvelteKit route with a +page.server.ts file which has a load function that retrieves a user record from a database. The user has a string property containing a comma delimited list of "collection" ids that user has access to. In the +page.svelte page, I display a form with checkboxes for each collection to allow an admin user to grant or revoke permissions to collections. Here is my code for displaying the checkboxes <form method="post" action="?/setCollections" use:enhance> <input type="hidden" name="email" value={data.user.email} /> <fieldset style:padding-left="1rem"> {#each data.collections as collection (collection.id)} <div style:margin-bottom=".5rem"> <input id={collection.name} name={collection.name} type=&q

Mysql2 error in NextJS13, cant find module Net

I'm trying to acquire information from a mysql database in nextjs13 using the mysql2 dependency, like this: import mysql from 'mysql2/promise' export const getData = async(req, res) => { const dbconnection = await mysql.createConnection({ host: "hostname", database: "databasename", user: "username", password: "password", }); try { const query = "SELECT productid, productname, productimage FROM products"; const values = []; const [data] = await dbconnection.execute(query, values); dbconnection.end(); res.status(200).json({ products: data }); } catch (error) { // unhide to check error // res.status(500).json({ error: error.message }); } return dbconnection } At first the error was that the net module was missing, which is called when mysql.createConnection is used. Then when I added the module, i

Vue ref change does not apply changes to the component after update

I have a form implemented with vue3. The form consists of three text inputs and a checkbox group. I am using bootstrap-vue form and it's checkbox-group for this. I call an api to set default values on the form, after the api responds I update the ref like the code below and all three text inputs get updated just fine . The problem is with the checkbox group component. The checked items won't get checked although they are inside of the tagList ref. // I set the formValues ref and api call to get default values in this composable. // taglist will be a list of strings: tagList = ['example'] const formValues = ref<IArticleFormValues>({ title: '', body: '', description: '', tagList: [], }); const { data, isFetching } = useQuery({ queryKey: ['fetchArticleBySlug', slug], queryFn: () => fetchSingleArticleService(slug) }); watch(data, () => { if (data.value?.article) { formValues.value

display a component by exporting in react

I am trying to lean react by solving a problem in react. Providing the react code challenge below. I am seeing the below error in browser. I googled but still no luck, not sure how to solve it. Providing my code below and stackblitz. Can you guys help me. Property 'stateDropdown' does not exist on type 'JSX.IntrinsicElements'.(2339) https://stackblitz.com/edit/stackblitz-starters-ngl4yu?description=React%20%20%20TypeScript%20starter%20project&file=src%2Fcomponents%2FstateDropdown.tsx,src%2Fcomponents%2FstateDropdown.css,src%2FApp.tsx&title=React%20Starter import { FC } from 'react'; import './style.css'; import { stateDropdown } from './components/stateDropdown'; export const App: FC<{ name: string }> = ({ name }) => { return ( <div> <stateDropdown /> <h1>Hello {name}!</h1> <p>Start editing to see some magic happen :)</p> </div> ); }; coding challenge h

Unable to load image from url fetched from sqlite database

I have a Web app(Electron.Js) using HTML,CSS & Javascript, where in I am saving an image url and background color as chosen by user to Sqlite database using : const reader = new FileReader(); reader.onload = function () { const imageUrl = reader.result; query = "INSERT INTO QuizWindow VALUES('" + imageUrl + "','" + selectedColor + "');"; db.queryStatement(query, (err, rows) => { if (err) { console.error(err.message); } else { rows.forEach((row) => { console.log(row); }); } }); }; reader.readAsDataURL(imageInput.files[0]); which works fine. But when I fetch the same data from Sqlite using: function LoadBackground() { var query = "SELECT * FROM QuizWindow ;"; db.queryStatement(query, (err, rows) => { if (err) { console.erro

RRweb is duplicating objects inside the replay

Im trying out rrweb & rrweb-replayer for its recording and replaying abilities, im having trouble recording properly and replaying. some of the issues im having: 1.[replayer] Node with id 'XYZ' not found. 2. Source map error: Error: request failed with status 404 Resource URL: null (Unsure if relevent) 3. the replay is not the same as the final HTML render- there are duplciate objects in the replay the recording and replaying are happening in this app.jsx in my react project: A visual compression: What the rrweb replayer records: my example project can be found in this link: use the package.json to install everything you need - the project uses vite,zustand and react Via Active questions tagged javascript - Stack Overflow https://ift.tt/7uKQ1jw