how to add multiple selected options in phalcon

Sourav

i have used phalcon form element to implement the multiple select option.

$payment_method_id = new Select('payment_method_id',array(1 => 'PayPal', 2 => 'amazon', 3 => 'skrill'),array(
        'class'         => 'form-control',
        'multiple'      => 'multiple'
    ));
    $payment_method_id->setLabel('Select Payment Methods');     
    $payment_method_id->addValidators(array(
        new PresenceOf(array(
            'message' => 'The No Of Web Pages is required'
        ))
    ));
    $this->add($payment_method_id);

now i can add one option selected easily by using

$payment_method_id->setDefault(1);

but i want to select more then 1 option at a time like 'PayPal' and 'amazon' will be selected always. can any one help me on this problem?

colburton

You just have to use an array as parameter:

$payment_method_id->setDefault(array(1,2));

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

phalcon form add options

From Dev

phalcon form add options

From Dev

Delete multiple selected rows in phalcon

From Dev

How to determine which options selected in multiple <select>?

From Dev

How to find the sum of multiple select's selected options?

From Dev

How to display all selected options using multiple bootstrap-select?

From Dev

How to assign HTML form multiple selected options to PHP variable?

From Dev

How to get selected options' ids in multiple pages in SugarCRM?

From Dev

How do different browsers handle multiple selected options

From Dev

how to get selected options from multiple dropdowns using getAllSelectedOptions

From Dev

Picking selected options in a multiple select

From Dev

How to add new view to Phalcon app?

From Dev

How to minify multiple javascript file in phalcon

From Dev

How to Join multiple tables in PHALCON FRAMEWORK

From Dev

How to Join multiple tables in PHALCON FRAMEWORK

From Dev

How to minify multiple javascript file in phalcon

From Dev

How to add multiple options to json_encode function by condition?

From Dev

How to add rows based on multiple selection options in html vue js?

From Dev

Add selected options to Select2

From Dev

Exclude selected options from multiple dropdowns in angularjs?

From Dev

Need to access the MULTIPLE (possible) Selected Options

From Dev

Assigning 'selected' to options of multiple select element

From Dev

clear checkboxes of selected options in jquery multiple select

From Dev

add options to select - multiple selects

From Dev

How to add 'selected ' Attribute when adding options using jquery at any position

From Dev

How can one set selected options for a cake php FormHelper multiple select?

From Dev

How to set an option from multiple options or array with different values to views as selected in select box using PHP

From Dev

How to trigger a button to appear only if multiple options from different drop-down menus have been selected

From Dev

How to add Options to a List

Related Related

  1. 1

    phalcon form add options

  2. 2

    phalcon form add options

  3. 3

    Delete multiple selected rows in phalcon

  4. 4

    How to determine which options selected in multiple <select>?

  5. 5

    How to find the sum of multiple select's selected options?

  6. 6

    How to display all selected options using multiple bootstrap-select?

  7. 7

    How to assign HTML form multiple selected options to PHP variable?

  8. 8

    How to get selected options' ids in multiple pages in SugarCRM?

  9. 9

    How do different browsers handle multiple selected options

  10. 10

    how to get selected options from multiple dropdowns using getAllSelectedOptions

  11. 11

    Picking selected options in a multiple select

  12. 12

    How to add new view to Phalcon app?

  13. 13

    How to minify multiple javascript file in phalcon

  14. 14

    How to Join multiple tables in PHALCON FRAMEWORK

  15. 15

    How to Join multiple tables in PHALCON FRAMEWORK

  16. 16

    How to minify multiple javascript file in phalcon

  17. 17

    How to add multiple options to json_encode function by condition?

  18. 18

    How to add rows based on multiple selection options in html vue js?

  19. 19

    Add selected options to Select2

  20. 20

    Exclude selected options from multiple dropdowns in angularjs?

  21. 21

    Need to access the MULTIPLE (possible) Selected Options

  22. 22

    Assigning 'selected' to options of multiple select element

  23. 23

    clear checkboxes of selected options in jquery multiple select

  24. 24

    add options to select - multiple selects

  25. 25

    How to add 'selected ' Attribute when adding options using jquery at any position

  26. 26

    How can one set selected options for a cake php FormHelper multiple select?

  27. 27

    How to set an option from multiple options or array with different values to views as selected in select box using PHP

  28. 28

    How to trigger a button to appear only if multiple options from different drop-down menus have been selected

  29. 29

    How to add Options to a List

HotTag

Archive