This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
reynierpm
I'm working on a component and I need some advice. Take a look to this code:
<form role="form" class="sky-form">
<div class="form-group">
<label class="input">
<i class="icon-append fa fa-money"></i>
<input type="text" name="amount" placeholder="50.00" required="required" data-request="{{ __SELF__ }}::onAmountChange" data-track-input value="" />
</label>
</div>
<div class="spacer10"> </div>
<a href="#" class="btn btn-light btn-icon btn-icon-right fa-angle-double-right pull-right">
<span>Siguiente</span>
</a>
</form>
<div id="results">
{{ __SELF__.amountToReload }}
</div>
And this is the code on the component:
public function onAmountChange()
{
$amount = post('amount');
if (empty($amount)) {
throw new \Exception(sprintf('Por favor introduzca un valor.'));
}
$this->page["amountToReload"] = $amount-($amount*(float) Settings::get('ppal_fee')-(float) Settings::get('ppal_discount'));
// $this->page["amountToReload"] = $this->amountToReload;
}
But DIV is not updated and POST comes empty, what I'm doing wrong here? How do I update the DIV with the value returned by the function?
1-2 of 2