Hi guys, as you may know the multiple values option in CCK for drupal 6 creates an 'add another item' button which uses AHAH to add another field.
I've managed to use form_alter to add a little select box next to it, hoping I could use the value of this select box to somehow affect the new field that shows up (that part I haven't figured out yet) but right now my problem is that the button has stopped working, it's giving me a js alert with "An error occurred." followed by the path of my AHAH callback with the arguments. The error is from Drupal.AhahError or something like that in misc/Drupal.js. Obviously it's because of the new form element, so what can I do to be able to have the form submit normally, but also so I can capture the value of the select?
Comments
Have you tried stripping out
Have you tried stripping out every thing and just return a '
Hello World
'
looking at the poll module could help but there's a lot in there
At the moment I have manage to add extra fields but I cant get easy access to there values - you need to start looking at the form state (once you resolve the js issue)
sorry I cant be more help Im trying to get past my bottle neck also
I had to create my own
I had to create my own version of content_add_more_js complete with a new menu callback for my forms to use (which I had to switch out with form_alter). My functions makes the necessary changes to the variables and then calls the default add_more_js function to finish it off.
module_load_include('inc', 'content', 'includes/content.node_form');
content_add_more_js($type_name_url, $field_name);
Now, to figure out how to capture the value.
2 'values' into one 'field' ?
OK here's a small part of my "form state" i get in hook_form_alter after hitting the 'add another item' ahah button.
This part of the code represents the submitted data from the first 'multiple value' row, I should be able to alter it here before it's rendered on the page by javascript.
Note: I have 2 columns set up "aid" and "type" for this field. I don't really know how to actually get two values into this field.
I need to manipulate this array to slip the 'type' value in (at this point in the code I know what 'type' is)
Something like this?
(p.s., 'one' is the string I typed into the first input field)