Skip Navigation

[Resolved] One-to-many-relationship & Edit post form

This support ticket is created 5 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 25 replies, has 2 voices.

Last updated by Lara 5 years ago.

Assisted by: Nigel.

Author
Posts
#1379323

I am trying to:

I have a "create" post form

[credform]
	<div class="form-group">
		<label>Cuteberry | Benutzer Name</label>
		[cred_field field='cuteberry-benutzer-name' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Sicherheitscode ausdenken und eintragen.</label>
		[cred_field field='post_title' class='form-control' output='bootstrap']
	</div>
	
	<div class="cuteberry-hide"><div class="form-group">
		<label>Buchungssystem -- Cuteberry | ### Porträt User</label>
		[cred_field field='@buchungssystem-selbstportrat.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="4651"]'] 
      </div></div>
	[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
[/credform]

Now I wonder, if it is possible to change the following piece of code

 [cred_field field='@buchungssystem-selbstportrat.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="4651"]'] 

automatically in the "edit" post form:

[credform]
	[cred_field field='form_messages' class='alert alert-warning']

	<div class="form-group">
		<label>Buchungssystem -- Cuteberry | ### Porträt User</label>
		[cred_field field='@buchungssystem-selbstportrat.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="4668"]']
	</div>  
	[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
[/credform]

Link to a page where the issue can be seen: hidden link

I expected to see: [wpv-post-id item="4668"] as slected item

Instead, I got: [wpv-post-id item="4651"] as slected item

#1379671

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi there

The "value" attribute of the cred_field shortcode is to provide a default value only, it does not override a current value if it already exists.

So you need an alternative solution to update the value automatically.

The best way to do that would be to use the cred_before_save_data API hook to modify the parent ID before the form submission is processed.

You can add a code snippet for this at Toolset > Settings > Custom Code, with the following code:

/**
 * Reset parent post ID on post edit form
 */
function ts_override_parent( $form_data ){

    $form_id = '123';

    if ( $form_data['id'] == $form_id ){
        // reset parent
        $_POST['@buchungssystem-selbstportrat_parent'] = '4668';
    }
}
add_filter( 'cred_before_save_data', 'ts_override_parent' );

Note that you will need to edit the id of the form this should apply to.

#1385537

Hi Nigel,

many thanks for your answer and also many apologies for the delay.

I did as you suggested, but nothing happend. Maybe I made a mistake somewhere. I will investigate it during the next days and I hope that I can't solve it myself. If I can't find the bug, it would be great, if I could contact you again.

Kind regards
Lara

#1385613

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sure, I'll just mark this as awaiting your feedback, and if you have some more details to share, please do.

#1387291

Hi Nigel,

many thanks. I will share the code with you, I don't find the mistake / problem.

The code of the CRED form is very long. The "interesting" piece can be found in the last 10 lines.
This is the code of the CRED form:


[credform]
	[cred_field field='form_messages' class='alert alert-warning']
	<div class="form-group">
		<label>Qualifikation Reitlehrer</label>
		[cred_field field='qualifikation-reitlehrer' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Mindestniveau Reitschüler Dressur</label>
		[cred_field field='mindestniveau-reitschuler-dressur' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Mindestniveau Reitschüler Springen</label>
		[cred_field field='mindestniveau-reitschuler-springen' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>10ner Karten</label>
		[cred_field field='10ner-karten' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Beritt: ja/nein</label>
		[cred_field field='beritt-ja-nein' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Beritt: Einheiten und -menge</label>
		[cred_field field='beritt-einheiten-und-menge' force_type='field' class='form-check-input' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Schulpferde: ja/nein</label>
		[cred_field field='schulpferde-ja-nein' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Schulpferde Dressur</label>
		[cred_field field='schulpferde-dressur' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Schulpferde Springen</label>
		[cred_field field='schulpferde-springer' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Möchtest du das Feld </label>
		[cred_field field='mochtest-du-das-feld-werdegang-zielgruppe-in-deinem-profil-als-dienstleister-anzeigen' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Werdegang | Bild</label>
		[cred_field field='werdegang-bild' force_type='field' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Beruflicher Werdegang</label>
		[cred_field field='beruflicher-werdegang' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Bild | Zielgruppe</label>
		[cred_field field='bild-zielgruppe' force_type='field' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Zielgruppe</label>
		[cred_field field='zielgruppe' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Möchtest du das Feld </label>
		[cred_field field='mochtest-du-das-feld-lehrgang-in-deinem-profil-als-dienstleister-anzeigen' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Möchtest du ein Pferd zu deinem Account hinzufügen?</label>
		[cred_field field='mochtest-du-ein-pferd-zu-deinem-account-hinzufugen' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 1</label>
		[cred_field field='plz1-reitanlage-1' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 1</label>
		[cred_field field='name-reitanlage-1' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (1)</label>
		[cred_field field='externe-reitschuler-erlaubt-1' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 1</label>
		[cred_field field='link-zu-webseite-reitanlage-1' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 2</label>
		[cred_field field='plz-reitanlage-2' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 2</label>
		[cred_field field='name-reitanlage-2' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (2)</label>
		[cred_field field='externe-reitschuler-erlaubt-2' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 2</label>
		[cred_field field='link-zu-webseite-reitanlage-2' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 3</label>
		[cred_field field='plz-reitanlage-3' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 3</label>
		[cred_field field='name-reitanlage-3' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (3)</label>
		[cred_field field='externe-reitschuler-erlaubt-3' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 3</label>
		[cred_field field='link-zu-webseite-reitanlage-3' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 4</label>
		[cred_field field='plz-reitanlage-4' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 4</label>
		[cred_field field='name-reitanlage-4' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (4)</label>
		[cred_field field='externe-reitschuler-erlaubt-4' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 4</label>
		[cred_field field='link-zu-webseite-reitanlage-4' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 5</label>
		[cred_field field='plz-reitanlage-5' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 5</label>
		[cred_field field='name-reitanlage-5' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (5)</label>
		[cred_field field='externe-reitschuler-erlaubt-5' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 5</label>
		[cred_field field='link-zu-webseite-reitanlage-5' force_type='field' class='form-control' output='bootstrap']
	</div>

	<div class="form-group">
		<label>PLZ Reitanlage 6</label>
		[cred_field field='plz-reitanlage-6' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 6</label>
		[cred_field field='name-reitanlage-6' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (6)</label>
		[cred_field field='externe-reitschuler-erlaubt-6' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 6</label>
		[cred_field field='link-zu-webseite-reitanlage-6' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 7</label>
		[cred_field field='plz-reitanlage-7' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 7</label>
		[cred_field field='name-reitanlage-7' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (7)</label>
		[cred_field field='externe-reitschuler-erlaubt-7' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 7</label>
		[cred_field field='link-zu-webseite-reitanlage-7' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 8</label>
		[cred_field field='plz-reitanlage-8' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 8</label>
		[cred_field field='name-reitanlage-8' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (8)</label>
		[cred_field field='externe-reitschuler-erlaubt-8' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 8</label>
		[cred_field field='link-zu-webseite-reitanlage-8' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 9</label>
		[cred_field field='plz-reitanlage-9' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 9</label>
		[cred_field field='name-reitanlage-9' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (9)</label>
		[cred_field field='externe-reitschuler-erlaubt-9' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 9</label>
		[cred_field field='link-zu-webseite-reitanlage-9' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 10</label>
		[cred_field field='plz-reitanlage-10' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 10</label>
		[cred_field field='name-reitanlage-10' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (10)</label>
		[cred_field field='externe-reitschuler-erlaubt-10' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 10</label>
		[cred_field field='link-zu-webseite-reitanlage-10' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 11</label>
		[cred_field field='plz-reitanlage-11' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 11</label>
		[cred_field field='name-reitanlage-11' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (11)</label>
		[cred_field field='externe-reitschuler-erlaubt-11' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 11</label>
		[cred_field field='link-zu-webseite-reitanlage-11' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 12</label>
		[cred_field field='plz-reitanlage-12' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 12</label>
		[cred_field field='name-reitanlage-12' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (12)</label>
		[cred_field field='externe-reitschuler-erlaubt-12' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 12</label>
		[cred_field field='link-zu-webseite-reitanlage-12' force_type='field' class='form-control' output='bootstrap']
	</div>

	<div class="form-group">
		<label>PLZ Reitanlage 13</label>
		[cred_field field='plz-reitanlage-13' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 13</label>
		[cred_field field='name-reitanlage-13' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (13)</label>
		[cred_field field='externe-reitschuler-erlaubt-13' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 13</label>
		[cred_field field='link-zu-webseite-reitanlage-13' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 14</label>
		[cred_field field='plz-reitanlage-14' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 14</label>
		[cred_field field='name-reitanlage-14' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (14)</label>
		[cred_field field='externe-reitschuler-erlaubt-14' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 14</label>
		[cred_field field='link-zu-webseite-reitanlage-14' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 15</label>
		[cred_field field='plz-reitanlage-15' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 15</label>
		[cred_field field='name-reitanlage-15' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (15)</label>
		[cred_field field='externe-reitschuler-erlaubt-15' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 15</label>
		[cred_field field='link-zu-webseite-reitanlage-15' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 16</label>
		[cred_field field='plz-reitanlage-16' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 16</label>
		[cred_field field='name-reitanlage-16' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (16)</label>
		[cred_field field='externe-reitschuler-erlaubt-16' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 16</label>
		[cred_field field='link-zu-webseite-reitanlage-16' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 17</label>
		[cred_field field='plz-reitanlage-17' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 17</label>
		[cred_field field='name-reitanlage-17' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (17)</label>
		[cred_field field='externe-reitschuler-erlaubt-17' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 17</label>
		[cred_field field='link-zu-webseite-reitanlage-17' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>PLZ Reitanlage 18</label>
		[cred_field field='plz-reitanlage-18' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Name Reitanlage 18</label>
		[cred_field field='name-reitanlage-lehrgang' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Externe Reitschüler erlaubt (18)</label>
		[cred_field field='externe-reitschuler-erlaubt-lehrgang' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Link zu Webseite Reitanlage 18</label>
		[cred_field field='link-zur-webseite-reitlehrer-lehrgang' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Weitere Reitanlagen auf Anfrage</label>
		[cred_field field='weitere-reitanlagen-auf-anfrage' force_type='field' class='form-control' output='bootstrap']
	</div>
	<div class="form-group">
		<label>Buchungssystem -- Cuteberry | ### Porträt User</label>
		[cred_field field='@buchungssystem-selbstportrat.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="4668"]']
	</div>
	<div class="form-group">
		<label>Load Selbstporträt für Kunden oder für Dienstleister</label>
		[cred_field field='@selbstportrat-element-portrat-user.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="4702"]']
	</div>
	[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
[/credform]

This is the code from the settings:


<?php
/**
 * New custom code snippet (replace this with snippet description).
 */

toolset_snippet_security_check() or die( 'Direct access is not allowed' );

// Put the code of your snippet below this comment.

/**
 * Reset parent post ID on post edit form
 */
function ts_override_parent( $form_data ){
 
    $form_id = '4787';
 
    if ( $form_data['id'] == $form_id ){
        // reset parent
        $_POST['@buchungssystem-selbstportrat_parent'] = '4668';
    }
}
add_filter( 'cred_before_save_data', 'ts_override_parent' );


/**
 * Reset parent post ID on post edit form
 */
function ts_override_parent( $form_data ){
 
    $form_id = '4787';
 
    if ( $form_data['id'] == $form_id ){
        // reset parent
        $_POST['@selbstportrat-element-portrat-user.parent'] = '4702';
    }
}
add_filter( 'cred_before_save_data', 'ts_override_parent' );


It doesn't conntect with the "4668" post and also it doesn't connect with the "4702" post.

Kind regards
Lara

#1387795

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

You have declared two functions with the same name which would cause a fatal PHP error, so the code snippet where you added this will surely have been disabled to prevent that.

You can combine but actions within the same function, like so:

/**
 * Reset parent post ID on post edit form
 */
function ts_override_parent( $form_data ){
  
    $form_id = '4787';
  
    if ( $form_data['id'] == $form_id ){
        // reset parent
        $_POST['@buchungssystem-selbstportrat_parent'] = '4668';
        $_POST['@selbstportrat-element-portrat-user_parent'] = '4702';
    }
}
add_filter( 'cred_before_save_data', 'ts_override_parent' );

Try updating your code and re-activating the code snippet.

#1387829

Ups rookie mistake. Thanks Nigel.
I changed it, but it still doesn't work.
Would it help, if I would give you access to my website ?

Kind regards
Lara

#1387959

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

OK, let me set a private reply for you to share credentials.

Please be sure you have a current backup.

#1388563

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Lara

Sorry, the site credentials do not work, could you please review them? You can edit your last reply to update them if needed.

Also, can you confirm how I can test the edit form?

#1388657

Hi Nigel,

I truely sorry. I greated a new account for you, but I forgot to hit the save button. Now it should work.
I will enter the other informations in my "privat answer", which I wrote yesterday.

Kind regards
Lara

#1388879

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Lara

I was preparing your site for testing and then I noticed that the snippet you added was inactive because of an error. I shared only the code itself above, but the opening php statement and the security check are required, so the snippet was disabled.

I've fixed that, so it is now running.

Do you want to test the edit form, as you know best what to expect?

#1389467

Ups another rookie mistake. Many thanks Nigel.
I tested it. Unhappily it still doesn't work.

#1389609

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Sorry Lara,

going back to where the code snippet is inserted, it is again disabled with an error, but the error is not descriptive, I can't see what the problem is.

So I've left it disabled, and added a new snippet with the same code. It is active and not reporting any errors so hopefully will work this time, could you check again?

#1389613

Thanks Nigel. Now the first "item" changed and shows the "new value". Thank you so much. Only the second item still shows the old version.

#1389833

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Are you sure, because checking the debug log where I echoed the $_POST object it has the following:

[@buchungssystem-selbstportrat_parent] => 4668
[@selbstportrat-element-portrat-user_parent] => 4702

And those are what are specified in the code:

    if ( $form_data['id'] == $form_id ){
      	// reset parent
        $_POST['@buchungssystem-selbstportrat_parent'] = '4668';
        $_POST['@selbstportrat-element-portrat-user_parent'] = '4702';
    }

Are those the correct IDs, for both?