Panos
asked on
<cvdiv bind="url........." and <cfinput type checkbox problem
Hello experts
I use this code:
<cfparam name="Url.S_Leasing" default="">
<cfdiv bind="url:../resultscheck. cfm?S_Leas ing={S_Lea sing}" ID="theDiv" style="height:20px; width:80px;"/>
<cfform>
<cfif url.S_Leasing EQ 1 >
<cfset checkleasing = 'yes'>
<cfelse>
<cfset checkleasing = 'no'>
</cfif>
<cfinput name="S_Leasing" id="S_Leasing" type="checkbox" checked="#checkleasing#" value="1" />
</cfform>
and using the cfdebug i see that when the checkbox is not checked value 1 is passed to the url:
Coldfusion Ajax Logger:
info:http: Replaced markup for element: theDiv
info:http: HTTP GET ../resultscheck.cfm?S_Leas ing=1&_cf_ containerI d=theDiv&_ cf_nodebug =true&_cf_ nocache=tr ue&_cf_cli entid=8E40 7863AA052B D8A1E25ADF 06B0023F&_ cf_rc=0
info:http: Replacing markup for element: theDiv from URL ../resultscheck.cfm?S_Leas ing=1 with params _cf_containerId=theDiv
info:LogReader: LogReader initialized
info:global: Logger initialized
Any help?
I use this code:
<cfparam name="Url.S_Leasing" default="">
<cfdiv bind="url:../resultscheck.
<cfform>
<cfif url.S_Leasing EQ 1 >
<cfset checkleasing = 'yes'>
<cfelse>
<cfset checkleasing = 'no'>
</cfif>
<cfinput name="S_Leasing" id="S_Leasing" type="checkbox" checked="#checkleasing#" value="1" />
</cfform>
and using the cfdebug i see that when the checkbox is not checked value 1 is passed to the url:
Coldfusion Ajax Logger:
info:http: Replaced markup for element: theDiv
info:http: HTTP GET ../resultscheck.cfm?S_Leas
info:http: Replacing markup for element: theDiv from URL ../resultscheck.cfm?S_Leas
info:LogReader: LogReader initialized
info:global: Logger initialized
Any help?
ASKER
Hi azadi
Here is a part of my resultcheck.cfm page.
Can you help me?
<cfquery name="WADAdboartikel" datasource="#request.dsn#" >
SELECT *
FROM artikel
WHERE (0=0
<cfif isdefined("Url.S_Leasing") >
<cfif Url.S_Leasing NEQ "">
AND Leasing = <cfqueryparam value="#URL.S_Leasing#" cfsqltype="cf_sql_tinyint" >
</cfif>
</cfif>
)
</cfquery>
<cfoutput>#WADAdboartikel. RecordCoun t#</cfoutp ut>
Here is a part of my resultcheck.cfm page.
Can you help me?
<cfquery name="WADAdboartikel" datasource="#request.dsn#"
SELECT *
FROM artikel
WHERE (0=0
<cfif isdefined("Url.S_Leasing")
<cfif Url.S_Leasing NEQ "">
AND Leasing = <cfqueryparam value="#URL.S_Leasing#" cfsqltype="cf_sql_tinyint"
</cfif>
</cfif>
)
</cfquery>
<cfoutput>#WADAdboartikel.
ASKER
Something else.
Is there another way to get the recortcount witout submutting the form?
Is there another way to get the recortcount witout submutting the form?
oops... the checkbox's attribute to be used in the binding should be .checked, not .selected...
here's the full working code:
<!--- form page --->
<cfparam name="Url.S_Leasing" default="0"><!--- default it to 0 instead of empty string --->
<cfdiv bind="url:../resultscheck. cfm?S_Leas ing={S_Lea sing.check ed}" ID="theDiv" style="height:20px; width:80px;"/>
<cfform>
<cfinput name="S_Leasing" id="S_Leasing" type="checkbox" checked="#yesnoformat(URL. S_Leasing) #" value="1" />
</cfform>
<!--- resutscheck.cfm --->
<cfparam name="url.S_Leasing" default="0"><!--- cfparam this on this page, too! --->
<cfquery name="WADAdboartikel" datasource="#request.dsn#" >
SELECT COUNT(*) AS ttlcount
FROM artikel
WHERE Leasing = <cfqueryparam value="#val(URL.S_Leasing) #" cfsqltype="cf_sql_tinyint" >
</cfquery>
<cfoutput>#WADAdboartikel. ttlcount#< /cfoutput>
Azadi
here's the full working code:
<!--- form page --->
<cfparam name="Url.S_Leasing" default="0"><!--- default it to 0 instead of empty string --->
<cfdiv bind="url:../resultscheck.
<cfform>
<cfinput name="S_Leasing" id="S_Leasing" type="checkbox" checked="#yesnoformat(URL.
</cfform>
<!--- resutscheck.cfm --->
<cfparam name="url.S_Leasing" default="0"><!--- cfparam this on this page, too! --->
<cfquery name="WADAdboartikel" datasource="#request.dsn#"
SELECT COUNT(*) AS ttlcount
FROM artikel
WHERE Leasing = <cfqueryparam value="#val(URL.S_Leasing)
</cfquery>
<cfoutput>#WADAdboartikel.
Azadi
as for getting the recordcount without submitting the form:
yes, there are multiple ways to do it, and i think you know all of them. at least you used most of these ways in the other things you are doing and posting questions about :)
js proxy to a cfc and binding directly to a cfc which returns the recordcount are 2 of these ways.
if i am misunderstanding what you mean by 'another way to get the recortcount witout submutting the form' - please clarify.
Azadi
yes, there are multiple ways to do it, and i think you know all of them. at least you used most of these ways in the other things you are doing and posting questions about :)
js proxy to a cfc and binding directly to a cfc which returns the recordcount are 2 of these ways.
if i am misunderstanding what you mean by 'another way to get the recortcount witout submutting the form' - please clarify.
Azadi
ASKER
Hi azadi.
I'm asking if there is another way because i don't know which of these function is faster.
Now for the solution you posted:
As is see it is passing true and false in url.
In database the values are 0 and 1.
How can i handle this in the resultcheck page.
I'm asking if there is another way because i don't know which of these function is faster.
Now for the solution you posted:
As is see it is passing true and false in url.
In database the values are 0 and 1.
How can i handle this in the resultcheck page.
ASKER
Is this OK?
<cfparam name="url.S_Leasing" default="0">
<cfif Url.S_Leasing EQ true>
<cfset S_Leasing = 1 >
<cfelse>
<cfset S_Leasing = 0 >
</cfif>
......
<cfif S_Leasing EQ 1 >
AND Leasing = <cfqueryparam value="1" cfsqltype="cf_sql_tinyint" >
</cfif>
In resultcheckpage
<cfparam name="url.S_Leasing" default="0">
<cfif Url.S_Leasing EQ true>
<cfset S_Leasing = 1 >
<cfelse>
<cfset S_Leasing = 0 >
</cfif>
......
<cfif S_Leasing EQ 1 >
AND Leasing = <cfqueryparam value="1" cfsqltype="cf_sql_tinyint"
</cfif>
In resultcheckpage
ASKER
Notice that if the value is 0 in database i want all the results (0 and 1)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok azadi it is working now
ASKER
I will come back with a question about binding values from a checkboxgroup
ASKER
Thank you very much for your help
regards
Panos
regards
Panos
try this:
<cfdiv bind="url:../resultscheck.
mind you, that will likely request the url with S_Leasing=true or S_Leasing=false url parameter - so make sure your resultscheck.cfm can react properly to true/false as url.S_Leasing value...
Azadi