?
Solved

Coldfusion bind problem

Posted on 2009-04-08
12
Medium Priority
?
394 Views
Last Modified: 2013-12-24
Hello experts
I use the bind function to get the recordcount of a query without submitting a form
This works fine.the problem is that i use the same code for other forms but some form fields are missing there.So i get an error Bind failed, element not found: S_Modell_ID.
The code is:
<cfdiv bind="url:../resultscheck.cfm?S_Mobile_ID={S_Mobile_ID}&S_Modell_ID={S_Modell_ID}" ID="theDiv" style="height:20px; width:80px;"/>
I use a default value:
<cfparam name="form.S_Modell_ID" default="">but it does not solve the problem
Any help?
0
Comment
Question by:Panos
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 4
12 Comments
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24103647
using <cfparam> to set a default value for form.S_Modell_ID only does that - sets a cf variable in FORM scope.
but bindings bind to FORM FIELDS, not variables in FORM scope - you need to have an actual form field with name="S_Modell_ID" to bind to it. even a simple hidden form field will do.

but i do not understand why do you need to bind your cfdiv to a form field that does not exist in your form???
even if you cfdiv is in a cfinclude'd file and is included in various pages which have different forms with different fields - you do not need to fix the field the cfdiv is binding to. you can easily use your form element's onChange or onClick events to fire off a js function which uses ColdFusion.navigate() function to populate the cfdiv...

your resultscheck.cfm page, presumably, already has all possible url vars <cfparam>'ed...

Azadi
0
 
LVL 2

Author Comment

by:Panos
ID: 24104293
0
 
LVL 2

Author Comment

by:Panos
ID: 24104471
0
Simplify Your Workload with One Tool

How do you combat today’s intelligent hacker while managing multiple domains and platforms? By simplifying your workload with one tool. With Lunarpages hosting through Plesk Onyx, you can:

Automate SSL generation and installation with two clicks
Experience total server control

 
LVL 2

Author Comment

by:Panos
ID: 24104528
0
 
LVL 2

Author Comment

by:Panos
ID: 24104553
0
 
LVL 2

Author Comment

by:Panos
ID: 24104580
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24104714
that 'tutorial' was dealing with submitting a cfform which is displayed inside a cfdiv.
from what i understand, you have a cfform in your page but you want to submit it to (and show search results in) another page displayed inside a cfdiv (loaded via <cfinclude>) - your form itself is NOT inside that cfdiv, right?

also, is it that you want to have different forms (with different fields) submit to the same page, or is it always only one and the same form (but maybe has different fields displayed/selected based on other fields)

in either case, using ColdFusion.navigate() function you can submit your form to (and show results in) a particular container on your page (like your cfdiv). no need for biding the cfdiv to anything - your form will post to resultscheck.cfm page, but will display it in your cfdiv.
on your resultscheck.cfm page you will have to parse submitted data to see which fields have been selected/filled in in the form, and construct your query to retrieve results based on those selections (or show an error/warning to the user if some fields which are required have not been filled in/selected).

i was originally thinking your form was a simple one with only 1-2 fields. in that case using the field's onclick/onchange events would have been fine. but with a form like on the link you posted that is not going to be a good option - with so many form fields you do not want to be re-submitting the form with a change in each one. you want the user to make all necessary selections first, then click a button which will fire off a js function that uses ColdFusion.navigate to submit your form into your cfdiv.

Azadi
0
 
LVL 2

Author Comment

by:Panos
ID: 24104966
Hi azadi.
First of all i want to tell you that i found a solution from you how it works with onchange:
<cfdiv bind="url:../resultscheck.cfm?S_Mobile_ID={S_Mobile_ID}&S_Modell_ID={S_Modell_ID@change}" ID="theDiv" style="height:20px; width:80px;"/> but i will need hidden fields as you say.
The forms are not always the same but they submit to the same page.
(f.e the field S_Modell_ID is only in one form but other fields like S_price field ,S_Hersteller_ID field are in the most forms)
.......no need for binding the cfdiv to anything...:You mean that i can bind the form and not the fields?
........ it is not a good idea..... but the function in the page (mobile) is working very fine.
In the example page here what must i do to have the best working solution:
<cfform action="../Results.cfm" method="get" name="SearchForm" id="SearchForm">

Make:
<cfselect name="S_Hersteller_ID"  id="S_Hersteller_ID" onchange="getModell(this.value);">
      <option value="">All</option>
      <cfoutput query="qHersteller">
      <option value="#qHersteller.Hersteller_ID#">#qHersteller.Hersteller_Text#</option>
      </cfoutput>
 </cfselect><br />
Modell:
<cfinput name="S_Modell" type="text"  value="" maxlength="22" /><br />
Garantie:
<cfinput name="S_Garantie" type="checkbox" id="S_Garantie"value="1"  /><br />
<cfinput type="hidden" name="S_Mobile_ID" id="S_Mobile_ID" value="1" />
<input name="" type="submit" />
</cfform>

<cfdiv bind="url:../resultscheck.cfm?S_Mobile_ID={S_Mobile_ID}&S_Hersteller_ID={S_Hersteller_ID@change}&S_Modell_ID={S_Modell_ID@change}&S_Modell={S_Modell}&S_Garantie={S_Garantie.checked}" ID="theDiv" style="height:20px; width:80px;"/>

0
 
LVL 27

Accepted Solution

by:
azadisaryev earned 2000 total points
ID: 24105079
i see... so your resultscheck.cfm page only returns the number of results, and not the results themselves...
if so, then what you currently have is probably the best, if not most elegant, solution. you are definitely better off binding your cfdiv to all possible form fields, so the user does not actually have to click anything to see if his selections return any results.
yep, you'll just have to have all the fields your resultscheck.cfm page expects in your forms, either as actual fileds or as hidden fields.

in your code above, since your S_Modell field is a text input field, i maybe would just add @blur, or even @none, to {S_Modell} binding in the cfdiv - i.e. {S_Modell@blur} - so that the binding on the div either does not fire at all when the value in that field changes (@none - it will include the value entered in the field, but will not cause the binding to fire off when that value changes) or fires off when that field loses focus (@blur) instead of when a user clicks in that field.

Azadi
0
 
LVL 2

Author Comment

by:Panos
ID: 24105152
Ok azadi.
I will do it like the way you say.
In a new question i will ask for the ......most elegant solution!!!
0
 
LVL 2

Author Closing Comment

by:Panos
ID: 31568227
Thank you azadi for your help
regards panosms
0
 
LVL 27

Expert Comment

by:azadisaryev
ID: 24105230
my calling it 'not the most elegant' solution does NOT mean it is not the most effective one in the particular situation...

Azadi
0

Featured Post

Simple, centralized multimedia control

Watch and learn to see how ATEN provided an easy and effective way for three jointly-owned pubs to control the 60 televisions located across their three venues utilizing the ATEN Control System, Modular Matrix Switch and HDBaseT extenders.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

718 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