Skip Navigation

[Resolved] Edit Post Form and add a new thextfield

This thread is resolved. Here is a description of the problem and solution.

Problem:

The issue here is that the user wanted to set some of their edit form fields to readonly.

Solution:

This can be done by using the readonly='true' attribute on the CRED shortcode.
Example

        [cred_field field="plaats" force_type="field" class="form-control" output="bootstrap" readonly='true']

This support ticket is created 5 years, 12 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 13 replies, has 2 voices.

Last updated by simonR-7 5 years, 12 months ago.

Assisted by: Shane.

Author
Posts
#1198686

I have a cred form designed to edit a post, that works all fine.

However, is iit possible to add another field for the edit, I would like to seperate the added text form the original text.

Related; Is it possible to show the original fields (name, address etc) but hide them from editing in this edit post form?

#1198710

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Thank you for contacting our support forum.

You mean just have the field be read only ?

If you send me a link to the form I can write some code to disable the fields from editing for you.

Please let me know .

Thanks,
Shane

#1198742

Hi Shane,

I wish only the field "toelichting" should be editable. The rest read-only.

[credform]
	<div class="form-group">
		<label>ABC Nieuwe lead Title</label>
		[cred_field field="post_title" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Voorletters</label>
		[cred_field field="voorletters" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Naam</label>
		[cred_field field="naam" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Adres</label>
		[cred_field field="adres" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Postcode</label>
		[cred_field field="postcode" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Plaats</label>
		[cred_field field="plaats" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Telefoon</label>
		[cred_field field="telefoon" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>E-mail</label>
		[cred_field field="e-mail" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Product</label>
		[cred_field field="product" force_type="field" class="form-control" output="bootstrap"]
	</div>
	<div class="form-group">
		<label>Toelichting</label>
		[cred_field field="toelichting" force_type="field" class="form-control" output="bootstrap"]
	</div>
	[cred_field field="form_submit" output="bootstrap" value="Wijzigen" class="btn btn-primary btn-lg"]
[/credform]

Regarding the field "toelichting" will it be possible to ad another field "toelichting(1)" when the post is edited?

#1198746

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

I'm assuming that these fields are text fields.

So what you can do is add the attribute readonly='true' to the cred_field shortcodes and it should disable the fields.

Thanks,
Shane

#1198858

Thank you, that will sove that issue.

Regarding the intitial question, can you give support on that or should I start a new ticket.

So basically I would like to edit the post but with a new textfield.

#1198860

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Regarding your original issue. Let me know if I got this correctly.

Is it that you want to add a new field for the text on the edit form but leave the original field in tact? Or is it that you just want an additional field on the edit form.

Please let me know.
Thanks,
Shane

#1198863

Shane,

Sorry if it wasn't clear.

I would like to leave the original field in tact.

#1198898

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

You should be able to do this, if you add a generic cred field to your edit form.

On your form all you need to do is Click the Add generic field button then add your field type.

This should allow you to have the additional field to your text form.

Thanks,
Shane

#1199096

Thank you Shane for the solution.

The only thing is that I am now struggling how to get this in the VIEW once the correction is saved.

#1199263

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

This part should be quite simple as well.

Could you let me know the slug of the field that you added ? The generic field.

You can display it in a view by just using this.

[wpv-post-field name='slug'] where you will replace slug with the slug of the custom field.

Thanks,
Shane

#1199325

It seems simple but somehow I can't get it working.

1. I have encluded the generic field to the form where to edit the post.
2. If I check the post in the backoffice, i don't see it. Therefor it doesn't also become visible in the frontend.

Will it be possibe to check for me directly on the site?

#1199335

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

Yes I can check for you .

I've enabled the private fields for your next response.

Please let me know the Post that I should be looking at.
Thanks,
Shane

#1199436

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Simon,

This should be working now.

What was needed is for it to be set to save to the database by using the "persist: 1" attribute.

Thanks,
Shane

#1199520

My issue is resolved now. Thank you!