Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ColdFusion and onChange HELP 1

Status
Not open for further replies.

kirtan

Programmer
Dec 18, 2000
3
US
I'm using three textboxes. Two of which are related by using the <cf_TwoSelectsRelated>. I need to add another textbox which is based on the result of the previous used box. For example textbox #1 called Release is linked with textbox #2 by using <cf_TwoSelectsRelated>. Now I want to link textbox #3 results based on the selection of textbox #1. I know I need to use the onChange function. but i'm not sure how. I'm fairly new using ColdFusion and would like to get some help. Look forward to hear some suggestions.
 
your textboxes :
<input type=text name=release onchange=&quot;javascript:toto()&quot;>
<input type=text name=box2>
<input type=text name=box3>

now :
- the javascript function called when the user changes the value of the 1st textbox is toto() (you have to define it, usually in the header, between tags <script> and </script>
- in this function, to retrieve the value entered in the 1st textbox : document.the_name_of_the_form.release.value (something like : if (document.the_name_of_the_form.release.value < 0) )
- and to set the value of the 3rd textbox : document.the_name_of_the_form.box3.value (something like : document.the_name_of_the_form.box3.value=2)

for more i need more info from you
 
thanks..i think i understand it. let me give this a shot. if it doesn't work out i'll send out more info.
 
ok, i've marked the thread just in case you need more info :]
 
I thought i had it. but i guess i don't. Let me provide you with some code and explain what i've already done.

<script>
/****************************************************************************
function name: validate
input : none
output : none
purpose : This function validates the required fields
****************************************************************************/
function validate()
{
//if (document.graph_query_page.release.selectedIndex == -1)
if (document.graph_query_page.release_no.selectedIndex == 0)
{
alert ( 'You must select a release number.');
return false;
}
else if (document.graph_query_page.activity.selectedIndex == 0)
{
alert ( 'You must select a Activity.');
return false;
}
return true;
}
</SCRIPT>
</head>
<body>

<!--------get releases from release table------------------>
<cfquery DATASOURCE=#datasrc# NAME=&quot;get_prod_release_no&quot;>
select distinct prod_productid, prod_name, release_relno from release_table,
products_table, prod_release_table
where release_relno = prod_release_relno(+)
and prod_release_productid = prod_productid(+)
order by lower(release_relno)
</cfquery>
<cfif #get_prod_release_no.RecordCount# GT 0>
<cfform action= &quot;/cgi/task_completion.pl&quot; method=&quot;POST&quot; name=&quot;graph_query_page&quot; >
<table align=&quot;center&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; border=&quot;0&quot; width=&quot;400&quot;>
<tr>
<td align=&quot;right&quot;><IMG align=middle height=41 src=&quot;images/fmab.gif&quot; width=41> </td>
<td align=&quot;left&quot;><H2>Percentage Task Completion Graph</h2><FONT color=#ff0000>
(Note:* indicates a mandatory field)</FONT></H3></td>
</tr>
</table>
<br><br>
<table>
<tr>
<td> </td>
<td align=left><CF_TaskTwoSelectsRelated
query=&quot;get_prod_release_no&quot;
name1=&quot;release_no&quot;
name2=&quot;product_name&quot;
display1=&quot;release_relno&quot;
display2=&quot;prod_name&quot;
value1=&quot;release_relno&quot;
value2=&quot;prod_productid&quot;
size1=&quot;auto&quot;
size2=&quot;auto&quot;
htmlbetween=&quot;<br><br>&quot;
forcewidth=&quot;50&quot;
autoselectfirst=&quot;yes&quot;
formname=&quot;graph_query_page&quot;></td>
<td>   </td>
</tr>
</table><br>
<table ALIGN=&quot;center&quot;>
<tr>
<td><font color=&quot;red&quot;>Activity</FONT> </td>
<td><select name=&quot;activity&quot; Size=&quot;5&quot;>
<option selected value=&quot;&quot;>-No Selection-</option>
</select><font color=&quot;red&quot;>*</FONT></td>
</TR>
</table>

<table align=&quot;center&quot;>
<tr>
<BR><BR>
<input type=&quot;hidden&quot; name=&quot;type_of_button&quot; >
<!--- Button for applying the entries--->
<td align =&quot;center&quot;><INPUT type=submit value=&quot;View&quot; onclick=&quot;return validate()&quot;></td>
<td></td>
<td></td>
<!--- Button for cancelling the entries--->
<td align=&quot;center&quot;><INPUT type=&quot;reset&quot; value=&quot;Reset&quot;></td>
</tr>
</table>
</cfform>
</cfif>
<p><p align=&quot;center&quot;>
<a href=&quot;javascript:parent.ACTION_FRAME.print()&quot;>Click here to print this page</a></p>

</body>
</html>

Now this is basically the current way i've got two cf statements connected to automatically populate the second drop down box. I refer to another file called &quot;TaskTwoSelectsRelated&quot; which based on the release populates the type of groups that exist for that particular release.

What i want to do is based on the release be able to add another drop down box which would display &quot;activity.&quot; So basically the boxes are related based on the release.

Further on i will be adding another list box &quot;details&quot; which will display results based on the activity. I hope this helps.

I'm farily new to this site myself...Is there a way I may be able to attach a file? I would also like to show what I've done with the &quot;TaskTwoSelectsRelated.&quot;

 
i don't know what CF_TaskTwoSelectsRelated is doing ... i don't really understand what you're trying to do maybe ...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top