Hi,

I have a problem using Edit module. Everything works great, but I must create custom validation's function which validate fields relative to others.

For example, I want to compare value of field_test_1 to value of field_test_2 to decide if I validate field_test_1 or not. But when we save inline a node, each fields are validated independently, so I can't do what I want.

Is there a way to access all form's fields values when we save a node after editing several fields?

Thanks for your help and sorry for my bad english...

Comments

sjeandroz’s picture

hi,
nobody can help me?
I think it's not something so complicated, and I think I'm not the only one who want to do something like that...

thanks and sorry for my bad english

Wim Leers’s picture

Assigned: Unassigned » Wim Leers
Priority: Major » Normal
Status: Active » Fixed

If you use in-place editing, all fields must be independently validatable. If that's not the case, then you cannot use in-place editing.

However, in your case it sounds like you could just load the existing node, look at fields' values for other fields than the one being in-place edited, and just get the data from there.

sjeandroz’s picture

Hi Wim Leers,

Thanks for your response,

Yes the method you advise me is what I finally do and it works.

Thanks!

Wim Leers’s picture

You're welcome!

Wim Leers’s picture

Oh, now that I think about it, what I said is actually wrong. For correctness, you should retrieve the entity-being-edited from CTools' TempStore instead. Because that other field's value may have been changed also, but is not necessarily already saved to the database.

sjeandroz’s picture

I understood what wou want to say. My code is the following to retrieve the other fields:

ctools_include('object-cache');
$tempstore_id = _edit_entity_tempstore_id("node", $form_state['entity']->nid);
$node = ctools_object_cache_get('edit', $tempstore_id);

Wim Leers’s picture

#6: perfect :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.