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

dddave’s picture

And also its issue queue. I remember a (ongoing I think) discussion where someone posted a solution for such a "link to terms" situation.

davecoventry’s picture

<div style="position: absolute; left: 100px; top: 100px; visibility: hidden; padding: 20px; background-color: #ccccff; z-index: 100; width: 600px; border-color: black; border-width: 2px;" onclick="closeeula();" id="eula"><b><u>Membership Rules;</u></b>
<ol>Some stuff</ol>
</div>
<script>
la = document.getElementById('eula');
function showeula(){la.style.visibility='visible';}
function closeeula(){la.style.visibility='hidden';}
</script>
<div style="text-align: center; padding: 20px; background-color: #ccccff;" onclick="showeula();">Please read <a href="#">Membership Rules.</a></div>

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

mtsanford’s picture

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.

davecoventry’s picture

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.

davecoventry’s picture

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.

nickbn’s picture

Isn't this what the 'legal' module does?