<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Fredouze</title>
    <description>The latest articles on DEV Community by Fredouze (@fredouze).</description>
    <link>https://dev.to/fredouze</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1013597%2Fb1e91c7a-cf6d-4acb-8ad6-f05c857cb3b2.png</url>
      <title>DEV Community: Fredouze</title>
      <link>https://dev.to/fredouze</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fredouze"/>
    <language>en</language>
    <item>
      <title>TypeError: event.target is undefined whith Turnstone</title>
      <dc:creator>Fredouze</dc:creator>
      <pubDate>Mon, 13 Feb 2023 21:06:39 +0000</pubDate>
      <link>https://dev.to/fredouze/typeerror-eventtarget-is-undefined-whith-turnstone-2gh2</link>
      <guid>https://dev.to/fredouze/typeerror-eventtarget-is-undefined-whith-turnstone-2gh2</guid>
      <description>&lt;p&gt;Hello everyboby i use this input whith Turnstone for de fonction autocomplete. But i this error: TypeError: event.target is undefined. But i am not whith input react. This is a like for Turnstone. &lt;br&gt;
&lt;a href="https://turnstone.tomsouthall.com/"&gt;https://turnstone.tomsouthall.com/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is my component &lt;/p&gt;

&lt;p&gt;`import { useId } from "react";&lt;br&gt;
import React from 'react'&lt;br&gt;
import Turnstone from 'turnstone'&lt;/p&gt;

&lt;p&gt;const styles = {&lt;br&gt;
    input: 'w-full h-12 border border-oldsilver-200 pl-10 pr-7 text-xl outline-none rounded',&lt;br&gt;
    query: 'text-oldsilver-800 placeholder-oldsilver-400',&lt;br&gt;
    typeahead: 'text-crystal-500 border-white',&lt;br&gt;
    cancelButton: &lt;code&gt;absolute w-10 h-12 inset-y-0 left-0 items-center justify-center z-10 text-crystal-600 inline-flex sm:hidden&lt;/code&gt;,&lt;br&gt;
    clearButton: 'absolute inset-y-0 right-0 w-8 inline-flex items-center justify-center text-crystal-500 hover:text-hotpink-300',&lt;br&gt;
    listbox: 'w-full bg-white sm:border sm:border-crystal-500 sm:rounded text-left sm:mt-2 p-2 sm:drop-shadow-xl',&lt;br&gt;
    groupHeading: 'cursor-default mt-2 mb-0.5 px-1.5 uppercase text-sm text-hotpink-300',&lt;br&gt;
    item: 'cursor-pointer p-1.5 text-lg overflow-ellipsis overflow-hidden text-oldsilver-700',&lt;br&gt;
    highlightedItem: 'cursor-pointer p-1.5 text-lg overflow-ellipsis overflow-hidden text-oldsilver-700 rounded bg-crystal-100',&lt;br&gt;
    match: 'font-semibold',&lt;br&gt;
    noItems: 'cursor-default text-center my-20'&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;// Set up listbox contents.&lt;br&gt;
const listbox = {&lt;br&gt;
    displayField: 'name',&lt;br&gt;
    data: (query) =&amp;gt;&lt;br&gt;
      fetch(&lt;code&gt;https://localhost:8000/livesearch?query=${encodeURIComponent(query)}&amp;amp;limit=10&lt;/code&gt;)&lt;br&gt;
        .then(res =&amp;gt; res.json())&lt;br&gt;
  }&lt;/p&gt;

&lt;p&gt;function TextField({ placeholder, labelTitle, value, onChange, error, name }) {&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const id = useId();

const handleChange = (event) =&amp;gt; {
    onChange(event.target.value);
}

return (

        &amp;lt;Turnstone id="autocomplete" listbox={listbox} styles={styles} typeahead={false} value={ value } name='ville'  onChange={ handleChange } placeholder="Enter a city or airport"/&amp;gt;

);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;p&gt;export default TextField;`&lt;/p&gt;

&lt;p&gt;Thanks for your reponses! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>I wold like creat search engine whit React/php</title>
      <dc:creator>Fredouze</dc:creator>
      <pubDate>Mon, 23 Jan 2023 21:32:39 +0000</pubDate>
      <link>https://dev.to/fredouze/i-wold-like-creat-search-engine-whit-reactphp-11b0</link>
      <guid>https://dev.to/fredouze/i-wold-like-creat-search-engine-whit-reactphp-11b0</guid>
      <description>&lt;p&gt;Hello every body! Il french and sory for my rough english. I creat now a search engine whit React and php but they are nothing  result, and nothing message for error exept "Firefox cannot establish a connection to the server at ws://localhost:3000/ws." in a console. &lt;/p&gt;

&lt;p&gt;This is my App for react:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react'
import Turnstone from 'turnstone'

const styles = {
  input: 'border p-2 bg-white w-full',
  listbox: 'border p-2 bg-white w-full'
}

// Set up listbox contents.
const listbox = {

  data: (query) =&amp;gt;
    fetch(`http://essai/mr/query.php?query=${encodeURIComponent(query)}`)
      .then(res =&amp;gt; res.json())
}




console.log(listbox);

export default function BasicExample() {
  return &amp;lt;Turnstone id="autocomplete" listbox={listbox} styles={styles} typeahead={false} /&amp;gt;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And this is my PHP is name query in my Wamp.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?php


header('Access-Control-Allow-Origin: http://localhost:3000');


 header("Content-Type: application/json");

$nbr = 0;

$data = array();

$output = '';

$name = $_GET['query'];




//fetch.php
$connect = mysqli_connect("localhost", "root", "", "immoffre");
$output = '';
if(isset($name))
{
 $search = mysqli_real_escape_string($connect, $name);
 $query =  "
 SELECT * FROM villes_france 
 WHERE ville_nom LIKE '%" . $search . "%'
 OR ville_slug LIKE '%" . $search . "%' 
 OR ville_code_postal LIKE '%" . $search . "%' 
 LIMIT 5
";
}
else
{
 $query = "
  SELECT * FROM tbl_customer ORDER BY CustomerID
 ";
}
$result = mysqli_query($connect, $query);
if(mysqli_num_rows($result) &amp;gt; 0)
{

 while($row = mysqli_fetch_array($result))
 {


    $nbr++;
    $data[$nbr]   =   $row["ville_nom"];




 }

}

echo json_encode($data);


?&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for your consideration! &lt;/p&gt;

</description>
      <category>career</category>
      <category>productivity</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
