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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update link variables with onchange?

Status
Not open for further replies.

mptwoadmin

Programmer
May 15, 2006
46
0
0
US
Hi,
I would like to update "Perc" with the first select below & "Time" with the second select below :both with an OnChange event:
Can i get some assistance; I am at a loss..I can get an onchange to other input fields but cannot figure this one out..

First Select:
<td>
<select name="percentage_below_<cfoutput>#right(ref_6,2)#</cfoutput>">
<option value="10" selected>10%</option>
<option value="20">20%</option>
<option value="30">30%</option>
</select>
</td>

Second Select:

<td><select name="time_frame_<cfoutput>#right(ref_6,2)#</cfoutput>">
<option value="0" selected>0</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
</select> </td>

<button id="add" onclick="PopupCenter('_eff_email_pop.cfm?perc=<cfoutput>#perc#&time=#time#</cfoutput>&machine=<cfoutput>#right(ref_6,2)#</cfoutput>', 'myPop1',450,400);">
 
And the code AFTER the ColdFusion tags have been processed looks like????

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
You'll have to rebuild your link each time.

Personally I'd do it from inside the PopupCenter function if you have access to the function declaration.

Otherwise you'd probably want to have a function that changes the onClick event of the button to accommodate the new parameters.

You'll also probably want to give your dropdowns an ID so they can be easily accessed.

Post the rendered code once all coldfusion variables have been replaced, and we can probably craft a working function.



----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
<script language="javascript">
function ShowMyDialog() {
var obj = new Object();
obj.data1 = document.getElementById('percentage01');
obj.data2 = document.getElementById('time01');
showModalDialog('_eff_insert.cfm', obj, ''); }
</script>

First Select:
<td>
<select id="percetage01" name="percentage_below_01">
<option value="10" selected>10%</option>
<option value="20">20%</option>
<option value="30">30%</option>
</select>
</td>

Second Select:

<td><select id="time01" name="time_frame_01">
<option value="0" selected>0</option>
<option value="10">10</option>
<option value="20">20</option>
<option value="30">30</option>
<option value="40">40</option>
<option value="50">50</option>
<option value="60">60</option>
</select> </td>

<input type=button value="CustomConfirm" onclick="ShowMyDialog()">

This is what I put together I currently return a 'null' value when attempting to pass the variable using the function. The 'id's' in the selects will be dynamic when complete.

If possible please reference how to use an 'OnClick' to change the values.

Thanks
 
This
JavaScript:
obj.data1 = document.getElementById('percentage01')
Is getting a reference to the select object itself NOT the value of the selected option.

JavaScript:
obj.options[obj.selectedIndex].value
Will get the selected value

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top