简体   繁体   中英

Zend +/- buttons to increase or decrease value

I currently have a Zend form where you add data into a number field. But I want to add 2 buttons where you can increase or decrease the value then Submit the data.

Current code :

$this->add(array( 
    'name' => 'score_1',
    'type' => 'Number',
    'options' => array(
        'label' => 'PPV',
     ),
));

Is it possible to edit that code, or would I need to find another solution?

EDIT: My mistake, not radio buttons.

The best way to achieve that is to create your own Form Element helper extends the Zend\\Form\\View\\Helper\\FormNumber helper.

You can modify the render, and add your +/- buttons (with javascript action to increase or decrease your element value) to erase the render() method.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM