editor request paramter?

editor request paramter?

moonoo1moonoo1 Posts: 11Questions: 6Answers: 0

hello.
I'd like to separate it from the editor storage syntax.

for example
if action="create"
$editor = Editor::ins~~~
elseif action="edit"
$editor = Editor::ins~~~
elseif action="delete"
$editor = Editor::ins~~~

I would like to know possible sample sources.

This question has an accepted answers - jump to answer

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    I see you're using Editor in your example, but our accounts aren't showing that you have a license - it just reports that your trial expired last month. Is the license registered to another email address? Please can let us know so we can update our records and provide support.

    Thanks,

    Colin

  • moonoo1moonoo1 Posts: 11Questions: 6Answers: 0

    I have paid now.
    Can you tell me the sample source?

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin
    Answer ✓

    Hi,

    Editor will always send an action parameter (full docs for the sent parameters here), so you could do:

    $editor = Editor::inst($db, 'myTable');
    
    if ($_POST['action'] === 'create') {
      ...
    }
    else if ($_POST['action'] === 'edit') {
      ...
    }
    else if ($_POST['action'] === 'remove') {
      ...
    }
    else {
      // Data fetch
      ...
    }
    

    Alternatively, you could use the server-side event handlers such as preCreate and preEdit.

    The best approach will depend upon exactly what it is you want to do. For example, do you just want to make one field not writeable on edit, or perhaps set a specific value (user id)?

    Allan

Sign In or Register to comment.