module works well when create content, but show error while to modify it.

error

reference error

error

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

glekli’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.08 KB

This issue is occurring when an existing node is being edited, and a field's original value is not among the allowed options any more due to the selection in the limiting field. I'm attaching a patch that resets the default value in the field when it's not valid anymore. The patch is against 1.5.

joachim’s picture

Status: Needs review » Needs work
+++ b/reference_option_limit.module
@@ -487,6 +487,24 @@ function reference_option_limit_form_alter(&$form, &$form_state, $form_id) {
+      if (!empty($illegal_options)) {
+        $element_limited[LANGUAGE_NONE]['#default_value'] = NULL;
+      }

Wouldn't it be better to remove just the illegal options, rather than all of them?

thegreatone’s picture

I had another situation for this problem. Editing a node seems to be fine. I got this error when creating a new node. When I first get in the form and select a value in the trigger field, it works fine and the limited field loads the proper values. If I change the value of the trigger field again, the error shows up and the values of the limited field does not reload to match the trigger field.

joachim’s picture

Does the patch fix your situation as well?

thegreatone’s picture

well...again it all depends on what version of the dev code this was applied, but on the current one it didn't help.

joachim’s picture

> again it all depends on what version of the dev code this was applied

Always try patches against the current HEAD from git. That's where it will be committed if it works. There's no point testing a patch against older code -- if it only works there, then it needs a reroll.

thegreatone’s picture

was trying on the current dev so..