How do I implement conditional fields?

More
10 Nov 2013 09:20 #21 by Demis [Fox-Labs]
Replied by Demis [Fox-Labs] on topic How do I implement conditional fields?
I'm sorry, but I'm afraid that currently this is not possible.

Please Log in or Create an account to join the conversation.

More
13 Nov 2013 01:03 #22 by Robert Gilbey
Replied by Robert Gilbey on topic How do I implement conditional fields?
Can I at least put a custom HTML Message above a particular field? I personally think this would be a nice feature to include in the commercial version which I purchased - using version 2.5.6.

http://www.ultravolt.com/customer-service

In this example, I want a block of text above Comments field that says the following:

If you do not know the exact part number that will meet your needs, please provide us your desired input voltage, output voltage/wattage, polarity, and application in the "Comments" field below. This will help ensure proper service and expedite your request.

Let me know if/how this can be done. Thanks.

Please Log in or Create an account to join the conversation.

More
03 Jul 2014 09:53 #23 by Adam Balcerzak
Replied by Adam Balcerzak on topic How do I implement conditional fields?
Conditional fields are necessary. It's is great extension, but I cannot do without conditional fields and in many cases I have to use Google Forms ;(

Please Log in or Create an account to join the conversation.

More
07 Jul 2014 02:46 - 07 Jul 2014 02:48 #24 by Graeme Moffat
Replied by Graeme Moffat on topic How do I implement conditional fields?

Can I at least put a custom HTML Message above a particular field?

This should work for 2.5.6
Add this to the xml files as described in adding-more-fields directly after the "customhtml1" group
<field name="customhtml2" type="textarea" filter="raw" rows="4" cols="48" label="COM_FOXCONTACT_TEXT_EXTRA_LBL" description="COM_FOXCONTACT_TEXT_EXTRA_DSC"/>
<field name="customhtml2display" type="hidden" default="1"/>
<field name="customhtml2order" type="text" label="JFIELD_ORDERING_LABEL" description="" size="5" default="50"/>
Add this to your language file, /administrator/language/en-GB/en-GB.com_foxcontact.ini (replace en-GB with your language code if it's not UK English - and translate if needed)
COM_FOXCONTACT_TEXT_EXTRA_LBL="Extra text line"
COM_FOXCONTACT_TEXT_EXTRA_DSC="A stand-alone line of text which can be placed anywhere in the form"
Add this to /components/com_foxcontact/helpers/fieldsbuilder.php around line 122 (after a similar line with "1" instead)
$this->LoadField("customhtml", 2);

Please Log in or Create an account to join the conversation.

More
19 Jul 2014 17:43 #25 by Tim Myerson
Replied by Tim Myerson on topic How do I implement conditional fields?
Um, I'm feeling (no I know!) I'm missing something obvious but having made the suggested modifications how exactly do I define the text that I want displayed?

Any pointers (simple instructions) would be very gratefully received.

Please Log in or Create an account to join the conversation.

More
20 Jul 2014 13:35 #26 by Graeme Moffat
Replied by Graeme Moffat on topic How do I implement conditional fields?
If you've done it correctly (and assuming I haven't made any typos :-), you should see this in the backend
Attachments:
The following user(s) said Thank You: Tim Myerson

Please Log in or Create an account to join the conversation.

More
20 Jul 2014 13:57 - 20 Jul 2014 14:14 #27 by Tim Myerson
Replied by Tim Myerson on topic How do I implement conditional fields?
I knew I was missing the obvious. It is, of course, there and it works perfectly, I can even use the field to display an image - simple stuff, but so satisfying to work that out too!

Thank you very much and I appreciate your patience!

Please Log in or Create an account to join the conversation.

More
20 Jul 2014 15:01 #28 by Graeme Moffat
Replied by Graeme Moffat on topic How do I implement conditional fields?

I can even use the field to display an image

It's never occurred to me that an image could be used - that would have to be true for the 'Page top' and 'Page bottom' text as well. It's just HTML, after all.

Please Log in or Create an account to join the conversation.

More
20 Jul 2014 17:03 #29 by Tim Myerson
Replied by Tim Myerson on topic How do I implement conditional fields?
Can I create additional fields for Page Top and Page Bottom in the same way?


Also I can't see the 'width of checkbox text' in the .css - when I 'inspect' the active site (Firefox Developer Tools) I see the following:


It seems I need to modify the code to affect line css.html:416 which is:
div#foxcontainer_c118 input, div#foxcontainer_c118 label.checkbox {
width: 270px;
}
but how can I do that? I thought that it would be in the bootstrap.css so I have created a copy of bootstrap.css and have chosen that under 'Advanced Options' but there is no such line, or even the number 275 within that file so where should I be looking please?
Attachments:

Please Log in or Create an account to join the conversation.

More
22 Jul 2014 09:55 - 30 Aug 2014 03:06 #30 by Graeme Moffat
Replied by Graeme Moffat on topic How do I implement conditional fields?

Can I create additional fields for Page Top and Page Bottom in the same way?

Yes. Copy the customhtml2 fields twice more, replacing every 2 with 3&4. Add the "LoadField" line twice more with "3" & "4" (this step is no longer necessary in the latest versions). Note that the "Ordering" values for the Page top (-1000) & bottom (1000) are hidden, but you could change them in the xml (or even make them visible - look at the "customhtml2order" field for clues).

Also I can't see the 'width of checkbox text' in the .css

Ha! There's another file in /media/com_foxcontact/css/bootstrap.css. But this value is dynamically loaded in, and is taken from the backend value set for text fields.
If you want a width different from the text fields, it's not hard to do that - if you only have one form, you could even hard-code it into the css by replacing the entire <php ... ?> with your value (don't forget the px).

EDIT: It's foxcontact.css, not bootstrap.css I forgot the name has changed.

Please Log in or Create an account to join the conversation.