Skip Navigation

[Resolved] Generic field doesn't show on form

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 12 replies, has 2 voices.

Last updated by WeiS2074 4 years, 4 months ago.

Assisted by: Waqar.

Author
Posts
#1708361
Capture7.PNG
Capture6.PNG
Capture5.PNG

Hi,

In the form editor I create a form for new post. The form content can be found on my screenshot. I create a page to include this form (see my screen shot). But when I create the post from this page. the below field doesn't appear.
1. form messages
2. Add media
3. embedded Media
4. Image

question 2: is there a WYSIWYG editor allow user to insert multiple pictures?

#1708439

Hi,

Thank you for contacting us and I'd be happy to assist.

I've checked the form that you refer to using the admin access details from the other ticket and here is why those fields are not showing:

1. form messages
This is not exactly an input field and it is there just to show system messages like when the form is submitted successfully or when there are some errors in the submission.

Whenever there are some error or information messages to show from the system, they'll be shown in place of this field.

2. Add media
This Add media field is also not an input field and it should be used when you need to show a fixed media item like an image, video, etc in the form's content.

In your form, this field is added but no media item has been specified, which is why nothing is showing.

3. embedded Media
This generic field is actually an input field, but it is not showing on the front-end because there is no "Field Slug" or "Label" specified.
( screenshot: hidden link )

Here is a guide on using the generic fields:
https://toolset.com/course-lesson/adding-generic-fields-to-forms/

4. Image
The same as the embedded Media field, it is also not showing on the front-end because there is no "Field Slug" or "Label" specified.

> is there a WYSIWYG editor allow user to insert multiple pictures?

- Yes, using the "Add Media" button above the "Deal Content" field, users can insert as many images, as they'd like.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1709401
Capture.PNG

5. How media is isolated by user? I login one subscribed user, I can see pictures that uploaded from the administrator.
6. How can I limit the size of each of uploaded media? How can I restrict to only upload picture?
7. when I click the content, there is a "p" appear on the bottom left corner. What is this? How can I remove it?

#1710347
visual-text-modes.png

Thanks for writing back.

5. How media is isolated by user? I login one subscribed user, I can see pictures that uploaded from the administrator.

- I couldn't reproduce this behavior on my test website with default Twenty Twenty theme and only Toolset Types and Forms plugins active.

Have you modified the user role permissions or capabilities for the default "subscriber" role, through any custom code or plugin?

You're welcome to share temporary admin login details of a clean website in a new ticket, where this issue can be seen, without any custom code or third-party plugins.

6. How can I limit the size of each of uploaded media? How can I restrict to only upload picture?

- To limit the size of the uploaded media item, you can use the hook "cred_form_ajax_upload_validate":
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_ajax_upload_validate

This reply has a good example of this hook's usage:
https://toolset.com/forums/topic/how-to-limit-the-file-upload-size-limit-from-the-cred-form/#post-1209307

If you'll use the "Image" type custom field, then only images will be accepted and if you'll use the "file" type field, then other types of files will also be allowed.

7. when I click the content, there is a "p" appear on the bottom left corner. What is this? How can I remove it?

- When using the "Visual" mode of the WYSIWYG editor, it automatically inserts the paragraph tag to format the text.

If you'd like to enter content in raw mode, without any automatic formatting, you can switch to "Text" mode.
( as shown in the attached screenshot )

Let me know if you have any follow up questions, and for future reference, please note that as per our support policy ( https://toolset.com/toolset-support-policy/ ), only one question or issue can be addressed through a single ticket.

You're welcome to open a new ticket for each new question or concern.

#1710371

to the question 5, you can find credential from previous ticket, or give me a private form.
Sorry for squeeze different question in one ticket. I will avoid it in the future.

#1712229

Thank you for your permission and I have the admin access details from the previous ticket.

To troubleshoot and investigate point # 5, it would be more efficient to work on your website's clone on my own server, without affecting the actual website.

Do I also have your permission to download a duplicator package of your website?
( the "Duplicator" plugin is already installed )

#1712241

yes, please.

#1713577

Thanks for the permission and I've successfully downloaded duplicator package from the website.

I'll update you with my findings, as soon as this testing completes.

Thank you for your patience.

#1713587

No problem.

#1720297

Hi Waqar,

Is it any update on this ticket?

#1720537

Hi,

Thank you for waiting and I apologize for the delay in getting back on this.

I'm just completing some testing and research related to this ticket and will share my detailed findings withing next few hours.

regards,
Waqar

#1721443

Hi,

Thank you for waiting as this investigation took longer than initially anticipated.

I've tested your website's clone on a couple of different servers and was able to reproduce the behavior mentioned in point# 5.

When I'm logged in as an administrator and use the "Add Media" button from the form on the "Create New Deal" page, I can see the media library images uploaded by the administrator.
( screenshot: hidden link )

However, when I'm logged in as a subscriber user and I haven't uploaded any image to the media library, no images are shown until I have uploaded at least one image using that subscriber user.

After that, the "Add Media" button shows images uploaded from all the users but adding the following code snippet in the active theme's "functions.php" file helped in restricting that to only show images uploaded by the current subscriber user:
( ref: hidden link )


add_filter( 'ajax_query_attachments_args', 'wpb_show_current_user_attachments' );
 
function wpb_show_current_user_attachments( $query ) {
    $user_id = get_current_user_id();
    if ( $user_id && !current_user_can('activate_plugins') && !current_user_can('edit_others_posts
') ) {
        $query['author'] = $user_id;
    }
    return $query;
}

Note: The administrator users will still able to see images from all users.

I hope this helps and please let me know how it goes.

regards,
Waqar

#1722273

Really appreciate for fixing this bug.