Problems, need help? Have a tip or advice? Post it here.
3 posts Page 1 of 1
Hello!

I am creating a data bound form. The form has a section for personal and business information. All fields in either of the sections are compulsory.

The use case now is that not people will have businesses. Some may be submitting the form to start a business. So I was wondering that if all editable regions are required so how do i get the condition to work.

This is my thought:
Code: Select all
<cms:if have_business=='1'>
     <!-- Bound part of the form for Business details goes here -->
</cms:if>


But i get stuck at two things:
1. How to get the have_business condition to be checked before submitting the form.
2. All fields are required so if the have_business==0 then how to submit the form.

What can be done.

Regards,
Aashish
Image
where innovation meets technology
Hi Aashish,

Following thread discusses ways of conditionally making a field 'required' -
viewtopic.php?f=4&t=9118&start=10

I think you should be able to adapt it work for multiple fields in your use-case.
The idea is to define the business fields as non-required to begin with. Once the 'has_business' condition becomes true (perhaps you have a checkbox for this), then use PHP to toggle 'required' bit.

Hope it helps.
Thanks sir.
Will give it a try and get back.

Regards,
Aashish
Image
where innovation meets technology
3 posts Page 1 of 1
cron