In my content profile page, I have a set of three elements: a search field, a set of checkboxes with data, a text area that shows the chosen options. I also have a number of onclick and keyup functions defined in a .js file, that fills the checkbox options, makes sure that entering values in the search field scrolls to the nearest checkbox, and when user checked a value it appears in the text area. So far so good.

How do I "copy" these elements and their functions to a separate page? I want a new page called "update my data" that has the exact same elements and functions, and I would just need to change the submit function. I am new to Drupal and Javascript, so sorry if this is a stupid question...

I tried using the content-profile update page and it doesn't copy the event handlers. Also, it allows the user to update all their data and I want only these elements.

I am using Drupal 6 and Content Profile module.


  • Welcome to Drupal answers, you need to include what version of Drupal you are using and the modules being used that you have a question about. There are three different user profile modules depending if you are using D6, D7, or D8 and they all are very different. – Brady Jan 31 '16 at 14:37
  • Sorry, added to original post (Drupal 6). I am using content-profile module. – Danielle Jan 31 '16 at 18:50

In the end I used the content-profile edit page, with the following modifications:

  1. It did copy the event handlers but the ajax call was calling the wrong url becasue of relative path problems. Using an absolute path instead fixed this issue and the event handlers worked perfectly.

  2. Used JavaScript to add a css class to the elements I wanted hidden, and styled in css that this class should have display:none.

  3. I needed to install a patch on the CCK module to solve an issue with a hidden on/off checkbox.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.