Two Editor instances with PHP Server-Side processing

Two Editor instances with PHP Server-Side processing

szakendreszakendre Posts: 24Questions: 10Answers: 0

Dear Friend,
I have a database with more than 50 fields, so I want to separate the editor form (basic datas / extended datas).
Of course it doesn't work. I did the two Custom Forms, And I did the two Editor instances.

editor = new $.fn.dataTable.Editor(
    {
        "ajax": "/staff.php",
        "table": "#example",
        "template": '#customForm',
        "fields":
        [...

    editor2 = new $.fn.dataTable.Editor(
    {
        "ajax": "/staff2.php",
        "table": "#example",
        "template": '#customForm2',
        "fields":
        [...

Question: Shall I use different (staff.php and staff2.php) server-side script, or shall I use the same?

In the staff.php I build the Editor instance:

$editor = Editor::inst( $db, $TABLE_TO_USE, 'torzsszam' )
    ->fields(...

$editor->process( $_POST );
$editor->json();

Question: How can I build the other instance? $editor2 = Editor?
Question: Can I use the same primary key (torzsszam) for both instances?

P.S.: Do You have any other idea how to handle such a big form?

Thank You and Best regards:
Endre, Szak

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,723Questions: 1Answers: 10,108 Site admin
    Answer ✓

    I would suggest in this case that you should use two different PHP scripts.

    Yes, you can use an individual one if you wanted, and then use a parameter (usually a GET parameter in the URL) to indicate which table should actually be used), but if you aren't certain about that method, use two different scripts.

    Allan

This discussion has been closed.