http://coldfusion.com logo
#cfml-general
Title
# cfml-general
o

Oz Coruhlu

03/21/2022, 8:33 PM
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

Michael Schmidt

03/21/2022, 8:37 PM
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

Oz Coruhlu

03/21/2022, 8:38 PM
it is an old site I think yes.
m

Michael Schmidt

03/21/2022, 8:42 PM
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

Oz Coruhlu

03/21/2022, 8:43 PM
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

Michael Schmidt

03/21/2022, 8:56 PM
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

Oz Coruhlu

03/21/2022, 8:58 PM
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

Michael Schmidt

03/21/2022, 8:58 PM
what shows up in your network tab of your browser?
a

Adam Cameron

03/21/2022, 10:46 PM
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

Oz Coruhlu

03/21/2022, 10:47 PM
after the 6th digit yes.
a

Adam Cameron

03/21/2022, 10:48 PM
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

Oz Coruhlu

03/21/2022, 10:49 PM
if I type the number with dashes it goes without that error
a

Adam Cameron

03/21/2022, 10:49 PM
What is an example of five digits that work, and six digits that don't work (as text pls 😉
o

Oz Coruhlu

03/21/2022, 10:49 PM
I can screen share if u d like
a

Adam Cameron

03/21/2022, 10:49 PM
no, really. Just paste the text
o

Oz Coruhlu

03/21/2022, 10:51 PM
555-555-5555 works, names works, 555555*5*.. gives error
1
a

Adam Cameron

03/21/2022, 10:51 PM
Just to confirm... what is the data type of each of
name
,
phone
and
email
.
o

Oz Coruhlu

03/21/2022, 10:51 PM
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

Adam Cameron

03/21/2022, 10:52 PM
thanks. That's much easier to deal with 😄
Which CFML engine and version?
o

Oz Coruhlu

03/21/2022, 10:53 PM
not sure, I dont do CF at all I am more of a UX/UI deve
a

Adam Cameron

03/21/2022, 10:54 PM
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

Oz Coruhlu

03/21/2022, 10:55 PM
that was something else I have fixed with someone’ help.
1
a

Adam Cameron

03/21/2022, 10:56 PM
with
55555
, what is the value that comes back from the AJAX req?
(five fives there, not six)
o

Oz Coruhlu

03/21/2022, 10:59 PM
a

Adam Cameron

03/21/2022, 11:01 PM
I'm not gonna deal with videos sorry
I need the text to copy and paste.
o

Oz Coruhlu

03/21/2022, 11:01 PM
just demo ing the issue. No worries
a

Adam Cameron

03/21/2022, 11:02 PM
yeah I understand the problem
the data is the problem.
a

Abhijit Mukherjee

03/23/2022, 3:49 AM
Kindly check the length of the fields in database
Pls check if there is some kind of JavaScript written for onclick or onkeyup
2 Views