Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

All other Modules

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Change the look of UserDefinedForms

Go to End

9 Posts   1986 Views


22 June 2010 at 11:07am Community Member, 18 Posts

Willr pointed me to using $Form to call my form from the UserDefinedForms module.

Of course, my client wanted some things changed.

I went digging for template to no avail.

I did find in the forum how to call the different elements of the form which would have worked great except no <form> tag and no <submit> button to be found:

I was using this:

<% control Form %>
         <% control Fields %>
            <% if Type == textarea %>
               <div style="overflow:hidden;">                  
                  <div class="formTitle">$Title &nbsp;&nbsp;$Message</div>
            <% else %>
               <div style="overflow:hidden;">
                  <div class="formError">$Message</div>
                  <div style="float:left">$Field</div><div class="formTitle" style="float:left;">$Title</div>
            <% end_if %>
         <% end_control %>
         <% end_control %>

$SubmitButton or $Submit does not work.

Is there a template being called when I use $Form that I can just edit? I tried to find what .php file is generating the code but just couldn't find it.

In the end, I just need to change the way the form looks.



22 June 2010 at 12:05pm Community Member, 181 Posts

This can best be achieved with form.css - if you know the layout of the form then you can use the element ID to style each individual form field or otherwise just style them by element type or class.


22 June 2010 at 12:10pm Community Member, 18 Posts

Right, except that in my case, I need the form field Titles to come after the form field, which is a little harder to accomplish with css unless I use the left: attribute and swap them around. It will just get a little harry doing it that way. I'm looking at the API for Form() as it seems to follow that, but still not finding how to display the submit button yet...still loooking.


22 June 2010 at 12:19pm Community Member, 181 Posts

In that case you can always add a "heading" after each form field which adds a label with a class of FormHeading then you can use css to hide the system generated labels.

it's not a pretty solution but means you can avoid editing the core.

Not sure what you're aiming for with the submit button.


22 June 2010 at 12:32pm Community Member, 18 Posts

Well, what I was talking about with the submit button was....if I use the code above, how do I display the submit button and the <form tag?

I'm reading here:$fields and looking at the Variables, but I just don't get it. And when I try stuff it doesn't work, or it may be that UserDefinedForms does not actually extend the Forms class.


using the Code above, I can almost rebuild the entire form, but I cannot figure out how to get the submit button to show...using what variable? ie $Submit and also the form tag? ie <form action="$action" method="$formMethod" $options>


22 June 2010 at 12:46pm Community Member, 181 Posts

Never had that problem with USerDefinedForms, the submit button is always there and the text on it set by the user in the CMS.

If you want complete control over the form layout and don't need/want the user to set it up with the CMS then [url=]tutorial 3[/url] deals with writing forms.

You should be able to use UDF to achieve your goals though without needing to touch any code or even template. Just set up the form in the CMS and use css to deal with layout and styling.


22 June 2010 at 6:46pm Forum Moderator, 5511 Posts

Well you have <% control Fields %> that returns all the fields in the form. But what you want are the 'Actions' like the submit.

<% control Actions %>
<% end_control %>

Use the default as a guide for what you need to include


23 June 2010 at 1:27am Community Member, 18 Posts


Why is that not in the documentation? I mean, in the API, under the Forms object, I saw the Actions() method, but there is no indications of what properties are available when you call it.

Am I just suppose to guess until I get it right?

Or am I just not reading the documentation correctly?

Go to Top