This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
cassiotalle
I'm trying to make a widget form in ajax that gets data from a json from a search. The big problem is that I can't get the value of the search in the onTest () method.
Render function
public function render(){
$this->vars['id'] = $this->getId();
$this->vars['name'] = $this->getFieldName();
$this->vars['value'] = $this->getLoadValue();
return $this->makePartial('form');
}
Partial
<input data-request="<?= $this->getEventHandler('onTest') ?>" data-request-update="series_data: '#load'" id="<?=$id?>_search" name="<?=$name?>_search" value="<?= e($value) ?>" />
<input data-request="<?= $this->getEventHandler('onTest') ?>" data-request-update="series_data: '#load'" type="button" name="" value="Carregar">
<div id="load">
</div>
onTest Function
public function onTest(){
$search_valur = post($this->getId()'_search'); //not works
mjauvin
try this:
public function onTest()
{
$search_value = post($this->getId() . '_search');
}
Last updated
cassiotalle
Sorry, it was a typo when creating a message in the forum. The search field does not exist in the post() function. when I search with a print_r (post ()); I would like to know how I access the value of this search field in onTest (), I cannot find this information.
cassiotalle
some more tests
$search_value= get('search_field') //not work return null
$search_value = Input::get('search_field') //not work return null
$search_value = post('search_field') //not work return null
1-5 of 5