Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Just going off the screen shot I would request that displaying the other text field happens only after selecting "Other" in the drop down list
Comment | File | Size | Author |
---|---|---|---|
#10 | cck_select_other-js.patch | 3.59 KB | mradcliffe |
#9 | cck_select_other-js.patch | 2.85 KB | mradcliffe |
#4 | ahah.patch | 6.03 KB | mradcliffe |
Comments
Comment #1
Flying Drupalist CreditAttribution: Flying Drupalist commentedsubscribe
Comment #2
mradcliffeYes. Actually at the our local user meeting today it came up. Someone was supposed to submit the new feature request, but I guess you beat him to it. ;-)
Comment #3
bryancasler CreditAttribution: bryancasler commentedI felt awkward jumping in with a suggestion this early but this is a feature I've long wanted and was overly excited to see you guys working on it. Can't wait to give it a go.
Comment #4
mradcliffeCCK and #ahah is fairly tricky to get right. I have something somewhat working, but it has issues. I might not have time to work on it for a while so I'll throw the patch up here.
issues:
Comment #5
3dloco CreditAttribution: 3dloco commented+1 ;-D
Comment #6
eme CreditAttribution: eme commentedIndeed, it would be awsome! Why take AHAH and not just a javascript?
Other question : is it necessary then to have the field into a fieldset?
Anyway it's a really great idea!
Comment #7
Flying Drupalist CreditAttribution: Flying Drupalist commentedYou need to use AHAH when making forms because of some security stuff drupal has going on to prevent injections. I think.
But in this case I don't think AHAH is necessary. Load the textfield on page load, then hide it with js. When other is selected show it again, and it'll work fine.
Comment #8
eme CreditAttribution: eme commentedExactly. Like the Conditionnal field module which does exactly that to hide CCK fields.
Comment #9
mradcliffeThank you for the feedback. I've been working on this a bit more, and I think you're right about not using AHAH/AJAX. Again, still a work-in-progress. I'll probably put this on hold until I get testing finished up.
Comment #10
mradcliffeOkay, after some changes to the dev version to fix some things up after I added testing... I have a patch ready to test for this.
Please use the latest dev version when it updates within 12 hours of this post.
Comment #11
clashar CreditAttribution: clashar commentedI am getting error in the header of my page:
//$Id$ /** * cck_select_other javascript file */ var cckSelectOther = {}; Drupal.behaviors.cckSelectOther = function (context) { // $.browser.msie == true ? $(this).click(Drupal.ConditionalFields.fieldChange) : $(this).change(Drupal.ConditionalFields.fieldChange); $.browser.msie == true ? $(this).click(cckSelectOther.blah) : $(this).change(cckSelectOther.blah); var selectId = 'edit-field-'+Drupal.settings.CCKSelectOther.field+'-select-other-list'; var inputId = 'edit-field-'+Drupal.settings.CCKSelectOther.field+'-select-other-text-input-wrapper'; var value = $('#'+selectId+' option:selected').val(); if (value == "other") { document.getElementById(inputId).style.display = 'block'; } else { document.getElementById(inputId).style.display = 'none'; } } cckSelectOther.blah = function () { var selectId = 'edit-field-'+Drupal.settings.CCKSelectOther.field+'-select-other-list'; var inputId = 'edit-field-'+Drupal.settings.CCKSelectOther.field+'-select-other-text-input-wrapper'; var value = $('#'+selectId+' option:selected').val(); if (value == "other") { document.getElementById(inputId).style.display = 'block'; } else { document.getElementById(inputId).style.display = 'none'; } }
currently I receive this error wether I try to install or uninstall the module.
Maybe I made a mistake, because firstly I copied patched file directly to server without uninstalling module. So now I can't use nor old version nor new one. I tried to uninstall or install, but always I do receive above mentioned error.
So now I can't achieve that module is to be displayed in "Uninstall" tab of Modules. Should it be?
Comment #12
clashar CreditAttribution: clashar commentedplease say what table/fields should be deleted to make a clean module delete?
Comment #13
mradcliffeHmm, that's odd. I've been patching it and reversing the patch multiple times on both mysql and postgresql boxes.
The module doesn't need to be uninstalled. You can remove a module from the system table by running
delete from system where name = 'cck_select_other';
or you can disable it by changing status to 0. You also can reverse a patch by runningpatch -p0 < cck_select_other-js.patch
and it will ask if you want to reverse it.Comment #14
clashar CreditAttribution: clashar commentedmradcliffe, thank you for quick reply.
Actually I didn't apply patch on server because I have no such access, instead I have applied patch on my local machine and just uploaded it with replacement to server. I have also tried to delete data from system table, but still with no success to delete the error.
But I found another similar module "Select (or other)": http://drupal.org/project/select_or_other.
If there is a big difference b/w these modules?
Comment #15
eme CreditAttribution: eme commentedThe last dev release does not include the js.. Is it normal?
I just tested the module above : it is indeed the same objective, the module being maybe more complex, but the thing is that is did not work on my install...
Comment #16
mradcliffeYes. This functionality has not been committed. It is in the latest attached patch.
(other module) I'm really depressed now because I thought I searched endlessly for it.
Comment #17
mradcliffecommitted.