0

I have a simple form like this:

$label=$p->add('View_HtmlElement')->setElement('h4')->set('Test');

$f=$p->add('Form'); 

$f->addField('Checkbox','click')->js('click')->getElement($label)->set('HELLO WORLD')->execute();

$f->addSubmit('Accept');

I couldn't find the way to make this, I need to change the $label value from 'Test' to 'HELLO WORLD'.

Is it possible?

AJM.MARTINEZ
  • 477
  • 2
  • 10

2 Answers2

3

You can use like so:

$label=$this->add('View_HtmlElement')->setElement('h4')->set('Test');
$f=$this->add('Form');
$f->addField('Checkbox','click')->js('click',$label->js()->text('hallo world'));

OR If you want to use Accept Button do it that way

$label=$this->add('View_HtmlElement')->setElement('h4')->set('Test');

$f=$this->add('Form');
$f->addField('Checkbox','click');
$f->addSubmit('Accept');
if($f->isSubmitted()){
    if($f->get('click')){
        $this->js(null,$label->js()->text('hallo world'))->execute();
    }
}
Kostiantyn
  • 1,792
  • 2
  • 16
  • 21
1

Seems like you need to learn jQuery first ;)

$label=$this->add('View')->setElement('h4')->set('Test');
$f=$this->add('Form');
$f->addField('Checkbox','click')->js('click',$label->js()->html('HELLO WORLD'));
$f->addSubmit('Accept');
Vadym
  • 749
  • 3
  • 15