PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Alter form input string

  1. haakonflender
    Member

    I have a form that posts into my blog. It has a file upload field that users upload their movies with. My webserver formats the video file to HTML5 compatible format and to display that video to visitors it needs to be in the format [video src="http://www.mysite.com/video"]. But the gravity form file uploader posts the complete URL like http://www.mysite.com/video.mov.

    how can I alter the URL that the file uploader creates to the shortcode I need it to be? Is gform_field_input the right way? An example would ofcourse be very much appreciated. :)

    Thanks

    Posted 12 years ago on Friday May 4, 2012 | Permalink
  2. David Peralty

    You would want to use the following hook:
    http://www.gravityhelp.com/documentation/page/Gform_pre_submission

    Then you could take the file URL and wrap it in whatever you like before you send it to the database.

    Posted 12 years ago on Friday May 4, 2012 | Permalink
  3. haakonflender
    Member

    Thanks for the reply,
    But will this mess up the file uploading process?

    Either way I could not get it to work. I did the following on form_display.php
    ...
    else{
    //pre submission action
    do_action("gform_pre_submission", $form);
    do_action("gform_pre_submission_{$form["id"]}", $form);
    do_action("gform_pre_submission", "pre_submission_handler");

    function pre_submission_handler($form){
    $_POST["input_6"] = "new value for field 6";
    }

    Shouldnt I see "new value for field 6" in my post?

    Posted 12 years ago on Monday May 7, 2012 | Permalink
  4. David Peralty

    Part of the issue is that you've put the code in the wrong spot. Please check this out:
    http://www.gravityhelp.com/documentation/page/Where_Do_I_Put_This_Code%3F

    Posted 12 years ago on Monday May 7, 2012 | Permalink