Dependant mandatory form items

Hi all, I am putting together a form which has a checkbox for the user to request a callback (among other options).

What I would like to do is have the telephone number field mandatory only if the ‘callback’ checkbox has been ticked. If it hasn’t, the field remains optional.

Is this possible/easy to do in FW?

Many thanks

Mark


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Yes it is doable but you will need to use some Javascript to achieve it.

Easy? - a relative term. Easy for Walter - not so much for the rest of us.

Much easier just to have the Tel No mandatory at all times.

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

the telephone number field mandatory only if the ‘callback’ checkbox has been ticked.

Also possible with CSS but only supported in later Browsers. What sort of Browser support do you need?

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks David, I suggested that to them but they do not want people to feel they are going to call them if they have not asked.

The other option I have discussed with them is a separate form just for the call back but they want the user to also be able to select other options too. Tricky one!

Mark


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I’m not really sure but I very much suspect that a lot of their customers will be using XP/IE!

On 27 Jan 2016, 1:42 pm, DeltaDave wrote:

the telephone number field mandatory only if the ‘callback’ checkbox has been ticked.

Also possible with CSS but only supported in later Browsers. What sort of Browser support do you need?

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I very much suspect that a lot of their customers will be using XP/IE!

Then you would be safer with a javascript solution - which of course wont work if javascript is disabled.

How much time/effort do you want to put into this - keeping the phone no field mandatory for everyone would save you some grief.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Maybe have the phone number mandatory, but have a check box labelled “please check here if you are happy for us to call you” or something similar?
Trev

On 27 Jan 2016, at 14:07, DeltaDave email@hidden wrote:

I very much suspect that a lot of their customers will be using XP/IE!

Then you would be safer with a javascript solution - which of course wont work if javascript is disabled.

How much time/effort do you want to put into this - keeping the phone no field mandatory for everyone would save you some grief.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Hi Guys, I have built the form with the telephone number field right after the callback checkbox. That way I have been able to leave the telephone number non-mandatory on the basis that people will fill in the field if they’ve asked for a call back.

If we find that this causes a problem, we can look again at it.

Many thanks for your replies - I wondered if there might have been a quick an’ easy solution :slight_smile:

Mark


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

I wondered if there might have been a quick an’ easy solution

As you have discovered - there isn’t.

The other thing to consider is that Browser support for the ‘required’ state is not universal. Surprisingly Safari wont give you an error like Chrome will.

Which means that you would have to tie this in with a Validation script like the Validation Suite of Actions you cant just add the ‘required’ attribute if you want majority Browser support.

As I mentioned earlier ‘How much time/effort do you want to put into this?’ are they willing to pay for it.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thanks David, as I said above, I think I have persuaded them to accept my solution - hopefully!

Many thanks

Mark


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

If they don’t - and make sure you get more money for custom code out of them first - then there is always http://deltadesign.co/FW7Test/make-field-required.html

This uses some hacked together jQuery, which is not ideal, but it could be written in vanilla javascript.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

it could be written in vanilla javascript.

And indeed it has been but support in early IE is an issue so a production version would require more work.

http://deltadesign.co/FW7Test/make-field-required-vanilla.html

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Thank you so much for that David.

In the meantime, I have spoken to the client again and they have decided to go with the form as is, but they are going to monitor the submissions and if they get too many through with no telephone number, we will use this. They are aware of the extra cost so if they do decide to go ahead, I am happy to reimburse you if we use.

Thanks again

Mark


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

Remember that this is not supported ( the required attribute) in earlier Browsers or Safari.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options

they have decided to go with the form as is, but they are going to monitor the submissions and if they get too many through with no telephone number, we will use this

After much fiddling about I have put together a solution that uses javascript validation instead of the not wholly Browser supported Required attribute. You can see it at

http://deltadesign.co/FW7Test/form-validate.html

With this method the telephone # field will only require validation if the Call Back checkbox is checked. There is no reason you cannot use the Required attribute as well which will be supported in later browsers with javascript disabled.

There is quite a bit of behind the scenes action going on so not something you want to jump into without being rewarded for it.

D


freewaytalk mailing list
email@hidden
Update your subscriptions at:
https://freewaytalk.softpress.com/person/options