possible to use unbound values in editor ?

possible to use unbound values in editor ?

crush123crush123 Posts: 417Questions: 126Answers: 18

i have a basic product table using ajax/json source, which on postCreate() adds rows to other tables in the database.

I would like to add the option so that the postCreate() function checks the value of a checkbox on the editor modal so the user can control this event, but the checkbox itself is not represented anywhere other than in the form, I just want it to appear and be able to check its post value

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,635Questions: 1Answers: 10,092 Site admin

    Include the checkbox in the form like you would do any other checkbox field (just don't define a Field in the PHP code!) then it will be available in the $values parameter that is passed into the PHP postCreate event.

    Regards,
    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    sorry, don't quite get it.

    does this checkbox lie outside of the fields: [ ] array ?

    is there an example ?

  • allanallan Posts: 61,635Questions: 1Answers: 10,092 Site admin
    Answer ✓

    There isn't an example of this I'm afraid.

    Add:

    { "name": 'unbound', type: 'checkbox', options: ... }
    

    to your Javascript for Editor.

    Then in postCreate use: $values['unbound'] to get the value of the checkbox.

    Allan

  • crush123crush123 Posts: 417Questions: 126Answers: 18

    thats great.

    in an effort to avoid adding the field value to the name, I was leaving out this parameter entirely, giving me an error.

    works a treat ! Thanks

This discussion has been closed.