By davecoventry on
Is this possible?
I have just created a user registration form through the Profile module and I've added around 50 or 60 fields. Bloody hell! Each field had to be added individually, painstkingly edited and then saved.
I want to put a link onto it to pop up a EULA or something similar so that I can get the user to acknowledge the agreement with a checkbox.
Anyway I can add a link onto the form? Maybe with a block? Hard code it in a file?
Comments
Check the terms of use module
And also its issue queue. I remember a (ongoing I think) discussion where someone posted a solution for such a "link to terms" situation.
Well I've added a horrible kludge.
The above block 'sort of' works but it's not really satisfactory. The link is at the bottom of the page rather than next to the tickbox, but it's the best I can think of.
It really would be handy to have some way of introducing text to the form, whether it's to add instructions (like 'pick one of the following options' before a list of checkboxes) or to add a link as I have done above.
~ Dave
if you can handle PHP, you
if you can handle PHP, you can use hook_form_alter() on the user registration form, and insert a form element of type 'markup' next to your tickbox.
You could also do it at the theme level, and theme the user form the way you want: iterate through the form items, render them one by one, and when you encounter your check box output your EULA html.
Handling PHP
Thanks for your input mtsanford.
I know my way around Perl so I think I have a reasonable chance of getting to grips with PHP. What I don't understand is where to place the code, what arguments the function takes and what to do with any returned values.
Alright, the arguments are specified on the API reference, but consider these specifications from the hook_form_alter page:
$form Nested array of form elements that comprise the form.Which form elements? Is the variable already populated, or do I need to define the array by hand? Or is this where I place my new text?
$form_state A keyed array containing the current state of the form.Where do I get this?
$form_id String representing the name of the form itself. Typically this is the name of the function that generated the form.This one is okay, I have a rough idea of what the function expects here.
Slightly Off Toppic...
Another (admittedly minor) gripe is the way the different sections are defined. All the Headings are displayed on the form in Alphabetical Order. I guess I can go through all 50 or 60 individual items and add a number in front of the Category heading to force it to display in the correct order.
I presume that this information is kept in a flat text file? Or would it be inserted into the MySQL db? If it's the former can I just edit the text file? It would be a lot less work.
Try legal module
Isn't this what the 'legal' module does?