I used the examples found here as my AJAX guide.
I have a custom form field
which is entirely defined in a single line as an array. My
DIV's and callbacks work perfectly. In the attributes field, I call a custom function that sets a
CSS property. No problems at all.
I need to duplicate this same functionality with another field on the same form. The field is '
status' - but it is defined elsewhere and I don't know where or have access to the code where it is defined directly.
Thus in my code, I append to the array for the form field such as :
$form['elements']['status']['#prefix'] = '<div id="ajax_status">'; $form['elements']['status']['#suffix'] = '</div>'; $form['elements']['status']['#disabled'] = myfn_disable_attendance($form_state);
When I update the attendance select field, it should update the ability of a user to change the status (i.e. is marked as attended, the student can no longer withdraw from the class).
Disabled should display the status, but not allow the user to modify the field.
The last piece is the callback that runs when the attendance select is changed, that is a single-line return:
Which is the same as I use in the working example, however for that it is
['elements']['refunded'] which if you see above, is defined on a single line.
When I modify the attendance field, the status field disappears and displays what appears to be the return code from my function that should be setting the display option to
It appears it is not re-building the entire form field. My call to return
$form['elements']['status'] and Im thinking it may be due to it being defined on multiple lines in multiple
Can anyone provide any pointers as to how to accomplish what I'm trying to do or help me identify what the code is actually returning from my callback function so I can better get a grasp on what I need to do here?