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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

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

[Solved] User Forms: Custom Fields, Add rule button doesn't do anything


Go to End


10 Posts   5212 Views

Avatar
Graphicator

Community Member, 62 Posts

26 June 2010 at 6:54am

I tried clicking on the green plus sign to add custom rule. I'm not sure what an add rule does, but nothing opens up after clicking on this link in the userforms module.

Avatar
Graphicator

Community Member, 62 Posts

26 June 2010 at 7:12am

There needs to be a change on UserForm.js line 255:
from

$(".customRules .addCondition").click(function() {

needs to match this. And then you can get Custom Fields to work.
$(".addCondition").live('click', function() {

Can anyone help me figure out how to add custom css rules to certain text fields. I would like first/last name to float next to each other on the same row (Custom CSS Userforms Help please)

Avatar
speedofmac

Community Member, 10 Posts

26 June 2010 at 8:00am

Thanks for this tip. Is there any reason why this isn't enabled by default?

Avatar
Willr

Forum Moderator, 5523 Posts

26 June 2010 at 9:39am

This was a bug that was fixed last week - http://open.silverstripe.org/changeset/106720

Download the trunk / daily build version from http://silverstripe.org/user-forms-module/ to get this fix. I'll give the 0.3.0 release another week for any more bugs and do some more testing and do a 0.3.1 release to cover this issue and a couple other ones.

Avatar
TotalNet

Community Member, 181 Posts

26 June 2010 at 10:05am

Edited: 26/06/2010 10:11am

Quote

Can anyone help me figure out how to add custom css rules to certain text fields. I would like first/last name to float next to each other on the same row (Custom CSS Userforms Help please)

The easiest way I have found is to style using the "id" of the field (or its container more specifically) which will be unique to that form based on the field type. Then use
div#EditableTextField1, div#EditableTextField2{float:left; clear:none}

in your form.css for example.

Only down-side is that the first two text fields of any other UDF will also float left.

Avatar
TotalNet

Community Member, 181 Posts

26 June 2010 at 3:00pm

@Willr

Do you think it would be appropriate to have an option to add an additional css class to a form field in the options dialogue?

It's perhaps not an ideal end user setting but I do think there is a need to control the layout of individual form fields sometimes, I've done it on several occasions and with a long form, styling with the id can get very tedious and runs into issues when you have more than one form on the site.

I have experimented with EditableTextField and got it working nicely using $field->addExtraClass(), no validation yet but I'm not going to bother unless you're open to it as useful functionality.

Cheers,

Rich

Avatar
Willr

Forum Moderator, 5523 Posts

26 June 2010 at 3:05pm

@TotalNet - Funny you mention adding classes. I had just created a ticket for it http://open.silverstripe.org/ticket/5751 from http://silverstripe.org/customising-the-cms/show/287199?start=0#post287207. But yes I think it would be useful and relatively easy to integrate.

Avatar
TotalNet

Community Member, 181 Posts

28 June 2010 at 1:43pm

Well in that case...

I've checked out the latest trunk code for UDF and will look into it this week. Do you have any timescales for 0.3.1 or can I take my time with this? ;)

Cheers

Rich

Go to Top