External Forms

Permalink
Created an external form and trying to do an onchange event when selecting from the dropdown. I keep getting a "ReferenceError: updateValues is not defined" error. Code works fine in jsfiddle just not in Concrete. What am I doing wrong.

Here's the code.

<?php
$form = Loader::helper('form');
defined('C5_EXECUTE') or die("Access Denied.");
if (isset($response)) {
?>
<div class="alert alert-info"><?=$response?></div>
<?php
} ?>


<style type="text/javascript" >
function updateValues()
{
$('#textboxid').val($('#vent_model').val());
}

$(document).ready(function () {
updateValues();
});
</style>




<form method="post" action="<?=$view->action('test_search')?>">

<p><?=$message?></p>

<div class="form-group">
<label ><?=t('Project Name:')?></label>
<?=$form->text('project_name')?>
<span style="text-align: right;"><label ><?=t('Date:')?></label>
<?=$form->text('project_date')?></span>
</div>

<div class="form-group">
<p>Instructions:</p>
<p>Enter data into shaded cells below. Select the vent model, enter the room dimensions, and select the type of walk-in to provide approximate operation conditions.</p>
</div>

<div class="form-group">
<p>Disclaimer:</p>
<p>The following calculations are to be used as a general guideline only. Kason does not guarantee the results, as many factors beyond those assumed can affect the amount of ventillation required in a refrigerated space. Some of these factors include, but are not limited to: the number of doors in the enclosure, air-tightness of the enclosure, refrigeration load (how quickly the temperature drops), the defrost cycle settings, etc. The experience and past results observed by the manufacturer of the walk-in on similar applications should factor heavily into the final selection. Calculations consider incoming flow only to relieve negative pressure and do not consider positive pressure from swing door closing or temperature increases from evaporator fans running during defrost.</p>
</div>

<div class="form-group">
<p>Select Ventilator Model:
<select id="vent_model" name="vent_model" onchange="updateValues();">
<option>Select a Model</option>
<option value="11">1825</option>
<option value="18">1826</option>
<option value="18">1827</option>
<option value="5">1830</option>
<option value="21">1832</option>
<option value="21">1832DBL</option>
<option value="60">1845</option>
</select></p>
</div>

<div class="form-group">
<p>Flow Rate for Vent @ </p>
<input type="text" id="textboxid" />
</div>

<div class="form-group">
<input type="submit" name="submit" value="submit" class="btn btn-default" />
</div>

</form>

 
mnakalay replied on at Permalink Best Answer Reply
mnakalay
This is wrong
<style type="text/javascript" >
function updateValues()
{
$('#textboxid').val($('#vent_model').val());
}
$(document).ready(function () {
updateValues();
});
</style>

Put JavaScript inside <style> tags won't do you any good. It should be <script> tags
Itdepartment replied on at Permalink Reply
Duh. I feel stupid. Totally missed that.
Thanks