The setup:
Requirements CPT
Submissions CPT
These are in a one to many relationships. Many submissions for one requirement.
I created a requirement views with a clickable filed that open the Submission Cred form
When opened up the reference to the requirements field is at the top of the form. I was recommended to hide it. I would, however, like to display it as a Text only field, not an input field as currently, so that the user can see what is the requirement they are uploading for.
Here is the code for the Submissions form as it looks currently with the Requirement field not visible. So would like it visible but only as a text only field.
I would furthermore like to make the post title automaticaly the same as this text field.
[credform]
<div class="form-group" style="display: none;">
[cred_field field='@requirement-submission.parent' class='form-control' output='bootstrap' select_text='--- not set ---']
[cred_field field="form_messages" class="alert alert-warning"]
</div>
<div class="form-group">
<label>Submission Title</label>
[cred_field field="post_title" class="form-control" output="bootstrap"]
</div>
<div class="form-group" style="display: none;">
<label>Date first uploaded</label>
[cred_field field="date-first-uploaded" force_type="field" class="form-control" value="[wpv-post-today]" output="bootstrap"]
</div>
<div class="form-group">
<label>Upload document</label>
[cred_field field="upload-document" force_type="field" class="form-control" output="bootstrap"]
</div>
<div class="form-group" style="display: none;" >
<label>Status</label>
[cred_field field="status" force_type="field" class="form-control" output="bootstrap"]
</div>
[cred_field field="form_submit" output="bootstrap" value="Submit" class="btn btn-primary btn-lg"]
[/credform]
Hello,
In your case, you can use Views shortcode [wpv-post-title] in the Toolset post form content directly, for example, add a line just below the hidden DIV tag:
More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-title
Output’s the current post’s title.
It seems that you might have misunderstood me.
Here is the code as I understood you suggested
[credform]
<div class="form-group" >
[cred_field field='@requirement-submission.parent' class='form-control' output='bootstrap' select_text='--- not set ---']
[cred_field field="form_messages" class="alert alert-warning"]
</div>
[wpv-post-title]
<div class="form-group">
<label>Submission detail</label>
[cred_field field="post_title" class="form-control" output="bootstrap"]
</div>
<div class="form-group" style="display: none;">
<label>Date first uploaded</label>
[cred_field field="date-first-uploaded" force_type="field" class="form-control" value="[wpv-post-today]" output="bootstrap"]
</div>
<div class="form-group">
<label>Upload document</label>
[cred_field field="upload-document" force_type="field" class="form-control" output="bootstrap"]
</div>
<div class="form-group" style="display: none;" >
<label>Status</label>
[cred_field field="status" force_type="field" class="form-control" output="bootstrap"]
</div>
[cred_field field="form_submit" output="bootstrap" value="Submit" class="btn btn-primary btn-lg"]
[/credform]
It is not yielding the intended solution
For ease of understanding, I have removed the diplay=none parameter on two fields. When you access the entry there is no value.
The intended workflow is as follow:
Client op the requirement view page (image 1) Select the document they want to upload and click on the upload here link.
that open the page as per image 2.
The drop down value has been fetched from the entry on image 1and will be hidden, however, This is the value that I need to display in a label or text box that is not editable but tells the customer what was the document they selected for upload. I then need to use this value furthermore to populate the "submission detail" field Image 2. This is, in fact, the post title field. This I know must be done with a function but I need assistance with that function, please.
Thanks for the details,
I assume you are using Toolset form shortcode [cred_child_link_form] to setup the link "Upload here" in your screenshot:
versteckter Link
If it is, after user click the link "Upload here", it will pass URL parameter "parent_requirement_id" to the target page, the value is "requirement" post ID, so in the Toolset form content, you can get the URL parameter "parent_requirement_id" value, like this:
[wpv-search-term param="parent_requirement_id"]
versteckter Link
Then use it to display the "requirement" post title, like this:
[wpv-post-title item='[wpv-search-term param="parent_requirement_id"]']
And you can still hide the parent selector with CSS codes.
HI Luo yang,
Thx for that advice, it works as hoped!
I am however still unclear on the question of auto-filling the "submission details" field with the above value. The Submission details are actually the post title of the submission CPT and I need to fill it with the correct information. The idea would also be to hide the "submission details" field as this will be auto-filled.
If you would be so kind as to assist me with this.
My issue is resolved now. Thank you!