``` <cfform class="searchform" method="post" ro...
# cfml-general
o
Copy code
<cfform class="searchform" method="post" role="search" action="/gcrm/dashboard/" >
      <div class="input-group">
      <cfinput name="name" type="text" autosuggest="cfc:autosuggest.findContact({cfautosuggestvalue})" matchContains="true"  class="form-control"  placeholder="Search Client(Phone/Name)"/>
 <span class="input-group-btn">
        <button class="btn btn-primary" type="submit"><i class="fa fa-search"></i></button>
      </span>
       <input type="hidden" name="searchit" value="yes" />
        </div>
 </cfform>
m
I hate to say it, but i would highly suggest not using the built UI tags for ColdFusion and CFINPUT... are you using a javascript framework?
o
it is an old site I think yes.
m
which framework are you using ... most have their own auto-completers that will most likely be more customizable / sturdy then the CF built in ones... argh... YUI is quite dead
o
I cant replace this since it is used everywhere and like I said site is built years ago. perhaps a JS to bind the enter key
not a deal breaker actually. but I have a strange issue when I enter phone number it trows this after the 6th number. if i add dashes or any other character it does not. so only when u type numbers.
m
my guess is it is when there are no results found... As an FYI your parameters should be cfqueryparam'd to help prevent SQL injection attacks.
o
the records are there, not sure why at the 6th number it starts trowing that. I can paste the whole number and search no problem
m
what shows up in your network tab of your browser?
a
So let me get this straight... the AJAX req for when the number is <=5 digits long returns the array your JS is expecting. On 6+ digits, it's just returning the raw number?
o
after the 6th digit yes.
a
Also... I'm not sure that shooting movies of what you're doing is the best way to articulate this info. Just show us the requests being made and the responses coming back, and how they differ from your expectations. Also... screen caps of code rather than the actual code... less helpful as well.
o
if I type the number with dashes it goes without that error
a
What is an example of five digits that work, and six digits that don't work (as text pls 😉
o
I can screen share if u d like
a
no, really. Just paste the text
o
555-555-5555 works, names works, 555555*5*.. gives error
✅ 1
a
Just to confirm... what is the data type of each of
name
,
phone
and
email
.
o
yes
Copy code
<cfcomponent output="false">

	<!--- Lookup used for auto suggest --->
	<cffunction name="findContact" access="remote" returntype="string">
		<cfargument name="search" type="string" required="false" default="">
		
		<!--- Define variables --->
		<cfset var local = {} />
		
		<!--- Query Location Table --->
		<cfquery name="local.query" datasource="saspcrm" >
		
            
           
            
            select	name as s
			from		clients
			where		name like '%#ucase(arguments.search)#%'
            
            
            UNION ALL
			
		
            
            			select	phone as s
			from		clients
			where		phone like '%#ucase(arguments.search)#%'
            
                        UNION ALL
            
            			select	email as s
			from		clients
			where		email like '%#ucase(arguments.search)#%'
            
          
            
			
		</cfquery>

		<!--- And return it as a List --->
		<cfreturn valueList(local.query.s)>
	</cffunction>

</cfcomponent>
Copy code
<cfform class="searchform" method="post" role="search" action="/gcrm/dashboard/" >
      <div class="input-group">
      <cfinput name="name" type="text"  autosuggest="cfc:autosuggest.findContact({cfautosuggestvalue})" matchContains="true"  class="form-control"  placeholder="Search Client"/>
 <span class="input-group-btn">
        <button class="btn btn-primary" type="submit"><i class="fa fa-search"></i></button>
      </span>
       <input type="hidden" name="searchit" value="yes" />
        </div>
 </cfform>
a
thanks. That's much easier to deal with 😄
Which CFML engine and version?
o
not sure, I dont do CF at all I am more of a UX/UI deve
a
Any fix for this is gonna require someone doing CFML
(I saw you asking for a freelancer y/day, so I understand yer predicament)
o
that was something else I have fixed with someone’ help.
✅ 1
a
with
55555
, what is the value that comes back from the AJAX req?
(five fives there, not six)
o
a
I'm not gonna deal with videos sorry
I need the text to copy and paste.
o
just demo ing the issue. No worries
a
yeah I understand the problem
the data is the problem.
a
Kindly check the length of the fields in database
Pls check if there is some kind of JavaScript written for onclick or onkeyup