• Resolved chelminski

    (@chelminski)


    Hi ??
    Currently, I already use auto-filling of some data from the URL.
    What do I expect? I would like this to not be visible to the person filling out the form. If some information is filled in automatically, I do not want the person filling out the form to be able to change this data.

    Solution 1:
    Possibility to hide the field so that it is included in the confirmation. Currently, when a field is hidden, it returns an empty value.

    Solution 2:
    Possibility to use the value from the URL directly when configuring the email notification. Instead of entering “user_bd” in the single field configuration window, add the ability to define a variable that I can enter directly in the email confirmation.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @chelminski

    I hope you are doing well today.

    If I understand your scenario correctly you have a form that users fill in the first place and then use the pre-populate feature: https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#pre-populate-form-field-values and later on, in 2nd form you auto-fill those data and those should be not editable? Let me know if we are on the same page so we can suggest some solution in that matter.

    Kind Regards,
    Kris

    Thread Starter chelminski

    (@chelminski)

    Hi
    Not completely. I’m creating a customer service panel. Depending on the displayed context (account view, user list view, etc.), various options (forms – data flow) are available. I would like to use your plugin for this, because I think it is the best ;). Information about the context is contained in the url.

    E.g. When displaying a given user’s account page, you see a link:

    https://example.com/user-details?user=chelminski&order_no=2137

    When you display a given group, action, etc. you also have context.

    And I would like it to be possible to include this information in the form, but in such a way that it could not be edited by the operator filling in the data. It would be best if the information was not visible in the form, but only on the confirmation.

    It would also be convenient because I could use such a solution for basic users and there would be no mess. I really want this feature :D, there are many application options.

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi again @chelminski

    I pinged our SLS Team in that matter to see can help in that matter and will that be within the support scope. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @chelminski

    Our SLS Team asked for more details in that matter as some of those are not fully clear.

    If we read this correctly: You have a register form and that form has custom fields, which you pass to the user profile by mapping those fields.

    Later on, on your custom page, you display those values and you have an additional form, which should automatically read those values to some hidden fields, and as soon as the form is submitted you will see those in your email notification.

    Please share more light on the full process so we can be on the same page.

    Kind Regards,
    Kris

    Thread Starter chelminski

    (@chelminski)

    Hi ??
    NO. There is no need to fill out the form to view the link with your data. I will present the whole process:

    1. I am searching for a user using email address or ID or name and surname
    2. I click on his profile. (We’re not talking about a WordPress profile here. Just a customized page)
    3. His profile is displayed at the link
    https://exapmle.com/user_details/?user={username}&id={ID}

    Not every operator has access to the same customer groups. So, for example, Operator 1 will see the data of an individual customer, but will not have access to a customer of another category (e.g. VIP customer, business customer, customer from another country).

    1. In order to change data/perform an action, a webhook is made to an external server using the “Forminator” form. Some data is completed automatically. They are loaded from link.

    Each view has its own link and its own data defined.

    Second example

    1. I am searching for a user using email address or ID or name and surname
    2. I click on his profile. (We’re not talking about a WordPress profile here. Just a customized page)
    3. I enter the customer’s order because, for example, I would like to change something. And I see the link:
    https://exapmle.com/order_details/?user={username}&id={ID}&order-id={order-id}  //e.t.c....

    4. In order to change data/perform an action, a webhook is made to an external server using the “Forminator” form. Some data is completed automatically. They are loaded from link.

    I keep talking about this function (I don’t know what it’s called in English). The function allows you to automatically fill out form fields based on data from the link.

    So my request is that the data that goes automatically to Forminator should not be visible to the operator. Or so that the operator cannot edit the selected field.

    I hope it’s all more clear now ??

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi again

    Thank you for additional data.

    Please us this snippet as a mu-plugin:

    add_action( 'forminator_before_form_render', 'wpmudev_prefill_field_form_check', 10, 5 );
    function wpmudev_prefill_field_form_check( $id, $form_type, $post_id, $form_fields, $form_settings ) {
        $form_ids = array( 1609 ); // Please add your form IDs.
    	if ( ! in_array( $id, $form_ids ) ) {
            return;
    	}
    
        add_filter( 'forminator_field_markup', 'wpmudev_readonly_prefilled_value', 10, 3 );
    }
    
    function wpmudev_readonly_prefilled_value( $html, $field, $cls ) {
        $prefilled_val = empty( $field['prefill'] ) ? '' : ( ! empty( $_REQUEST[ $field['prefill'] ] ) ? $_REQUEST[ $field['prefill'] ] : '' );
        if ( ! empty( $prefilled_val ) ) {
            $html = str_replace( 'value="'.$prefilled_val.'"', 'value="'.$prefilled_val.'" readonly', $html );
        }
        return $html;
    }

    Form ID should be managed $form_ids = array( 1609 ); // Please add your form IDs.

    To learn more about how to install MU-Plugin to a site, please, check this out:?https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind Regards,
    Kris

    Thread Starter chelminski

    (@chelminski)

    Thank you very much! It works! ????

    Is it possible to completely hide a given field with a snippet? (So that it works for my case, so that it doesn’t return an empty value).

    Thread Starter chelminski

    (@chelminski)

    Hi

    I just noticed that this function already exists.

    It’s called a hidden field and it does what I wrote above. You can use variables from the RUL address there, it is not displayed in the form. My bad.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Automatic data from URL’ is closed to new replies.