Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Dynamic Form baside on if a yours has put a check in the box.

Posted on 2003-12-01
5
Medium Priority
?
219 Views
Last Modified: 2013-12-24
I have a list of upgrade option that a user can chose from.  Like hard drive, memeory, monitors and so on.   On the page it will have a list of check boxes for each option.   The dynamic part come in at time of when check boxis is clicked.   Ok, a user clicks on HD, saying he wants to upgrade his hardrive, at the point I would like to create a NEW list of check boxis basis on the option we have for HD sizes in our database.  The user then clicks on the size, sizes they would like.  After I have there specific upgrades i can take them to a new page to enter the quanity.  I know how to pull the data data form the froms after they are filled just now how to get them on the page.

I'm not sure on how well JavaScript and CF play together.  
Right now my from actions are posting to the same page.  Then i have cfif asking what is deffenid and then the data is made baised on that.

The problem is I cant use a form method to call a funtion that would create the new forms basad on the cfquery informaiton.  I'm not really even sure how to get a method to run a cfquery.
Can i create my own functions in CF to be called by a from method.  If I created my own tag, something, how i get it to run with the onclick.
I haven't see to many other peoples CF codeing so I'm really kinda lost on this one.  I know how it should work but not sure how to do it.
I know I cant use CF variable is Javascript and vice versa.
I know is a tough one.  It seems hard to bring the two together.

Thanks for your help
0
Comment
Question by:jbtipps
[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
  • 2
  • 2
5 Comments
 
LVL 17

Assisted Solution

by:Tacobell777
Tacobell777 earned 750 total points
ID: 9854559
Hi jbtipps,

CF and Javascript go very well together, they are seperate programming languages. JavaScript is client side, ie. it runs in the clients browser, and CF is server side it runs on the server.

You can make CF talk to JS and vice versa, you do this with WDDX, look it up in the docs or visit www.openwddx.org

As for your need, it can be done with JavaScript, however you have to ask yourself first, do I expect all my clients to have JavaScript turned on, am I able to cater for all Browsers when using JavaScript, if the answer is still yet.

Then you retrieve all the data you need on one page, and in the first instance hide everything that only needs to be displayed when an option is choosen.

example:
HD 1 <input type="checkbox" value="hd1" onClick="var obj = document.getElementById('size'); obj.style.display = 'inline'; obj.style.visibility = 'visible'; "><br/>
HD 2 <input type="checkbox" value="hd2" onClick="var obj = document.getElementById('size'); obj.style.display = 'inline'; obj.style.visibility = 'visible'; ">

<div id="size" style="display: none; visibility: hidden;">
Size 1 [checkbox]<br/>
Size 2 [checkbox]<br/>
Size 3 [checkbox]
</div>

This is all just simple stuff to show you how it can be done, if you understand it all you should probably write js functions to do the hiding etc.

PS. I wrote all the code in here, so there might be an error somewhere

Hope it helps..
0
 
LVL 25

Accepted Solution

by:
James Rodgers earned 750 total points
ID: 9854565
what about hiding the sub data in a table and as the user makes a selection showing the subselection table?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<script>
function ShowSubGroup(objTable, strStatus){
      document.getElementById(objTable).style.display=strStatus;
}

</script>
      <title>Untitled</title>
</head>

<body>
<table name=" upgrades">
<tr>
   <td><input type="checkbox" name="hd" value="true" onClick="if (this.checked){ShowSubGroup('tblUpgHd', 'block')}else{ShowSubGroup('tblUpgHd', 'none')}"> Hard Drive<table id="tblUpgHd" style="display:none"><tr><td><input type="radio" name="hdUpgrade" value="40">40G</td></tr></table><td>
</tr>
<tr>
   <td><input type="checkbox" name="mon" value="true" onClick="if (this.checked){ShowSubGroup('tblUpgMon', 'block')}else{ShowSubGroup('tblUpgMon', 'none')}"> Monitor<table id="tblUpgMon" style="display:none"><tr><td><input type="radio" name="monUpgrade" value="21TFT">21" TFT</td></tr></table><td>
</tr>
</table>


</body>
</html>

you can populate teh tables dynamically
0
 

Author Comment

by:jbtipps
ID: 9854729
Thank you both for you answer.  I have never since justers_48 way to show/object before.  Kind cool.  I don't know what i was thinking.  I was just trying to make it alot harder then it was i guess.  
There is a nice little crossbrowers code I found at dhtmlcentral.com, if you guys and gals haven't checked that place out yet.  Its just a browers check then sets variables for the accessing properties.  Its in the header of all thier pages.  Not sure if that is kinda like a industry standerd or what.

I will deffently read up on WDDX as well.

Thank you both again.
0
 

Author Comment

by:jbtipps
ID: 9854731
just makeing the points higher
0
 
LVL 25

Expert Comment

by:James Rodgers
ID: 9857726
thanks for the points!
0

Featured Post

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

Question has a verified solution.

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

In our day to day coding, how many times have we come across a necessity to check whether a URL is a broken link or not? For those of you that answered countless and are using ColdFusion like myself, then this article is for you.  It will show yo…
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

636 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