• Hi!
    I have bought the editor extension and installed it. I’m trying this shortcode:

    [cfdb-datatable form="*" edit="cells" filter="email=$user_email"]

    on the front-end on my website to make it possible for people who has submitted the form and later is logged in on the website with the same e-mail address as they filled in in the email-field on the form to edit their submission.

    It almost works. It works to the point that the datatable displays the correct submission by matching the “email”-value to the $user_email. But it’s not possible to edit the cells…
    I have also changed the settings in the Options to allow All users to edit.

    Am I missing something?

    • This topic was modified 9 years, 2 months ago by mackans.
    • This topic was modified 9 years, 2 months ago by mackans.
Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter mackans

    (@mackans)

    Currently I have these two plugins installed:

    Contact Form DB
    Contact Form DB Editor

    Am I missing one more plugin?

    Plugin Author Michael Simpson

    (@msimpson)

    I think editing will not work when using “*” for the form name. You must indicate the actual form name.

    Thread Starter mackans

    (@mackans)

    I have now tried with the actual form name instead of * but it doesn’t work.

    I tried the most simple shortcode like this:

    <?php echo do_shortcode('[cfdb-datatable form="Form Name" edit="cells"]'); ?>

    and that gives me the whole datatable with around 300 submissions but none of the cells are editable.

    Plugin Author Michael Simpson

    (@msimpson)

    I haven’t used this inside a “do_shortcode” call. The shortcode queues up some javascript files for WP to be added to the page on which it appears. I wonder if those hooks are already called by the time your code is called, and therefore it is too late for WP to add the Javascript to the page.

    Thread Starter mackans

    (@mackans)

    Hmm okay. Is there another way to call a shortcode instead of using do_shortcode?

    Marcus

    Plugin Author Michael Simpson

    (@msimpson)

    Just putting the shortcode in the post.

    Thread Starter mackans

    (@mackans)

    Sorry, but I don’t really understand. If I just put

    [cfdb-datatable form="Form Name" edit="cells" filter="email=$user_email"]

    in the HTML code, the exact same will be shown on the web…

    What about something like this, is this a good start? Can you help me finish it if I’m on the right track?

    add_shortcode('editregistration', 'editregistration_callback');
    function editregistration_callback ('Form Name', array('edit' => 'cells', "filter" => "email=$user_email")) {
        
    }
    • This reply was modified 9 years, 2 months ago by mackans.
    • This reply was modified 9 years, 2 months ago by bdbrown.
    Plugin Author Michael Simpson

    (@msimpson)

    I’m confused. The shortcode is to show it on a webpage so that people can see data and edit them. I don’t understand what you are trying to accomplish that is different.

    Thread Starter mackans

    (@mackans)

    I’m more confused than you are for sure. When I’m just putting the shortcode directly in the HTML code this is what I get on my webpage:

    Shortcode harnotrail.se

    I have many other shortcodes on the webpage and they work great, and I have put all of them in a “do_shortcode” call.

    I’m using a custom theme and custom templates. Is that the reason why it’s not working to just put the shortcode directly into the HTML code?

    /Marcus

    Plugin Author Michael Simpson

    (@msimpson)

    Try switching the post editor to Text mode instead of Visual, then paste in the shortcode.

    Thread Starter mackans

    (@mackans)

    I’m using Advanced Custom Fields for most of my texts on the web. Didn’t know that I could put the shortcode inside a wysiwyg field. I just did that and the datatable shows up just fine. BUT, it’s still not editable!!

    What am I doing wrong? As i said before I have everything installed and activated. The editor extension is working fine in the admin panel.

    Marcus

    Plugin Author Michael Simpson

    (@msimpson)

    I’m not familiar with Advanced Custom Fields. Can you walk me through exactly what you are doing?

    Thread Starter mackans

    (@mackans)

    Sure, I’ll try to explain!

    Step 1.
    Ht 1
    In the Advanced Custom Fields panel, I create a new field group with one field. I name the field, assign it a unique field name registration-shortcode, and choose the field type. In this case I choose a WYSIWYG-field. I also choose on which page/pages I wan’t this field group to show up so that I can edit the content in the WYSIWYG-field later.

    Step 2.
    Ht 2
    In order to make the content I put in the WYSIWYG-field to display on front-end, I add this code to my HTML code <?php the_field('registration-shortcode'); ?>. Note the identical unique field names.

    Step 3.
    Ht 3
    Next I go to the page that I choose the field group to show up on. And here’s my recently created WYSIWYG-field ready to be edited. I add the shortcode [cfdb-datatable form="Anmälan Långa" edit="cells" filter="email=$user_email"]

    Step 4.
    Ht 4
    The content in the WYSIWYG-field will show up on front-end perfectly!

    But the datatable is not editable.

    • This reply was modified 9 years, 1 month ago by mackans.
    Thread Starter mackans

    (@mackans)

    Hi again Michael
    Any ideas on this? Is there something wrong with my version of the plugin? If you try the same shortcode does it work for you? Are the cells editable? Do you think it has something to do with my custom theme? Is there something missing in my custom theme? Anyone else had this problem before?

    /Marcus

    Plugin Author Michael Simpson

    (@msimpson)

    It looks like none of the Javascript is being loaded on the page. The shortcode tells WP that it needs some scripts loaded. But I think in this case, since the shortcode is being loaded in a round-about way, that by the time the shortcode is called, it is too late to add the scripts. So you don’t get any of the datatable decoration (like search field) or editability.

    I think that if you look at the HTML for that page, you will NOT see “cfdb.edit.js” in it. But if you just put that shortcode directly in a post, then you do. Would you verify that hypothesis?

    I’d have to work through this example and see if there is a way to make my plugin inject the scripts in that scenario.

Viewing 15 replies - 1 through 15 (of 18 total)

The topic ‘Edit submission on front-end doesn’t work’ is closed to new replies.