⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Reset SELECT after update in edit form



woof

woof
  • profile picture
  • Member

Posted 06 January 2016 - 08:02 AM

My goal is to have a SELECT with some pseudo value (not in database) to trigger something (mail) in "callback_after_update". But to avoid confusion and double action, when only "Update changes" is used (without direct "go back to list") I need to reset this SELECT to initial state when action is done and form shown again (with success message). And I really don't see how?

 

At first I tried to change field value in $post_array, but that obviously does not apply. So I tried JavaScript manipulation of the rendered page, but I think I have problems understanding how this can be done with jQuery and the Chosen framework (where the styled SELECT comes from). As far as I can see my SELECT has it's FALSE value, but the control still shows TRUE (and submits it). F.i. I triggered 'chosen:updated' event on the SELECT but that does not do any change.  Maybe it's about timing, but when I tried to attach 'chosen:ready' event listener to SELECT it is not called.

  • Any hints on changing SELECT value?
  • Is there a way to have a (more plain HTML) CHECKBOX instead of a SELECT in Grocery?
    (The "active"/"inactive" radio buttons from "true_false" field type don't really match and modifying Grocery code to change labels is not in my intention.)
  • Or is it possible in Grocery to reset SELECT value in earlier phase while remembering posted value somewhere else for use in "callback_after_update"?

 

Thanks