Solved

CfSelect Bind using URL:page.cfm?state={firstselect.value}

Posted on 2009-04-02
2
1,137 Views
Last Modified: 2013-12-20
I am having an issue returning a value for the code below: I get JSON Parsing error

I have the form that is bind to URL - works fine but I get the error on the parse.

All code is below.
<!---Page 1 the form--->

<cfquery name="Recordset1" datasource="mydsn">

SELECT distinct State

FROM zipcodeworld

order by state

</cfquery>

 

<cfform name="form1" action="#CGI.SCRIPT_NAME#">

  <cfselect name="firstselect" query="Recordset1" value="state" display="state"/> <!--- works great =--->

  <cfselect name="secondselect" bind="url:citylookup.cfm?mystate={firstselect.value}" value="city" display="city"/>  <!---   This part does not work --->

</cfform>
 
 
 

<!---Page 2 the URL its binded to:--->

<cfquery name="Recordset2" datasource="mydsn">

SELECT distinct city

FROM zipcodeworld

WHERE state = <cfqueryparam cfsqltype="cf_sql_VARCHAR" value="#url.mystate#">

</cfquery>
 

<cfoutput>

#serializeJSON(Recordset2)#

</cfoutput>

<!---  it needs to return all cities in state selected from bind on form page --->

When I run the code i get a JSOn Parsing error on form page.

Open in new window

0
Comment
Question by:LeadCo
2 Comments
 
LVL 27

Accepted Solution

by:
azadisaryev earned 500 total points
Comment Utility
do you use Application.cfm?
does it output anything, like site header/footer, or a <DOCTYPE ...> declaration or some javascript?
that all will break the returned json because it will be appended to the response from the url...

Azadi
0
 

Author Closing Comment

by:LeadCo
Comment Utility
I did have some html in application removed and works great.

Thanks!
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

Suggested Solutions

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to automatically show related posts at the bottom of a blog post in WordPress. This will be demonstrated using a Windows 8 PC. Plugin “Yet Another Related Posts Plugin” will be used. Go to your…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now