• Resolved acharseth

    (@acharseth)


    Hi!

    I am trying to make a solution where I use HF as input form, make a trigger which copies the input to another table where I can administer the input.
    When copying the string array in wpR_hf_submissions my norwegian letters are unicode escaped. Like ‘?’ becomes ‘\u00e5’. I have not found an easy way to convert this escaped unicode. Is there a way to configure HF not to use escaped unicode?

    Arne

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi Arne,

    This conversion is handled by PHP’s json_encode function, and is automatically reverted when you json_decode the string value.

    Instead of using a trigger in SQL, perhaps it’s more useful for you to hook into hf_form_success instead? From there, saving the submission (or only the data you need) would look something like this:

    
    add_action( 'hf_form_success', function( $submission, $form ) {
       global $wpdb;
       $wpdb->insert( 'my_table', array( 'name' => $data['NAME'] ) );
    }, 10, 2 );
    

    Hope that helps. If not, let us know please.

    Thread Starter acharseth

    (@acharseth)

    Thanks for your quick answer!

    This is probably a better solution, yes.
    (The only drawback is may be that it will not support for instance importing data and WordPress restores which a trigger would).

    As I am new to WordPress and using such hooks I hope you can provide me with some more information or may be a link to a how to.

    Should I add this action to src/Actions/Action.php?
    Inside public function hook()?

    Thread Starter acharseth

    (@acharseth)

    Hi again!
    I tried the setup above but have one challange:
    $data is NULL
    $submission is blank
    $form just gives me the html-form, not the data
    So what am I doing wrong?

    add_action( ‘hf_form_success’, function( $submission, $form ) {
    global $wpdb;
    $wpdb->insert( ‘Loppehenting’, array( ‘Kommentar’ => $submission, ‘Hva’ => $form ) );
    }, 10, 2 );
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to avoid escpaced unicode’ is closed to new replies.