Select to view content in your preferred language

Web Form Functionality with Dynamic Constraints

2768
10
Jump to solution
01-11-2023 02:39 AM
SamGatter
Occasional Contributor

Hiya,

I have encountered an issue with using functions in the constraints column that are working fine in connect and the S123 app, however when publishing and trying to use the form in the web, the functionality breaks.

In my survey form I have several constraints that prevent the user from inputting a date within a certain time frame, in my example there are two unique time frames that need to be used that are based off a previous selection the user makes.

There are two methods that I have attempted that work in connect, but not the web:
   Using another field to calculate the time frame dynamically
I.e. 
This is the calculation for a field called date_constraint_fine
   if(selected(${solution_type},'Survey_123'),7, if(selected(${solution_type},'Quick_Capture'),7, if(selected(${solution_type},'Web_App'),7, if(selected(${solution_type},'Dashboard'),7, if(selected(${solution_type},'Web_App_3D'),7, if(selected(${solution_type},'Map'),7, 1))))))
Then this value is pulled into the constraint of another question
   (.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * ${date_constraint_fine}))
   
   Using nested if statements within the constraint column
I.e.
   if(selected(${solution_type},'Survey_123'),(.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * 21)),
if(selected(${solution_type},'Quick_Capture'),(.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * 21)),
if(selected(${solution_type},'Web_App'),(.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * 21)),
if(selected(${solution_type},'Dashboard'),(.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * 21)),
if(selected(${solution_type},'Web_App_3D'),(.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * 21)),
if(selected(${solution_type},'Map'),(.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * 21)),
(.>= ${scope_date_req}) and (.>=${scope_date_req} + (1000 * 60 * 60 * 24 * 7))))))))

 

There is also an issue I have encountered when using readonly functions as well
These are 3 unique questions:

${solution_status}='Staging' or ${solution_status}='Production' or ${solution_status}='Launch'
${solution_status}='Production' or ${solution_status}='Launch'
${solution_status}='Launch'

Whilst this works in connect and the app, the functionality breaks when using it in the Web, i.e. all the questions don't go readonly. 

I have attached a copy of the relevant part of the survey that has this functionality. 

I would like to understand if there are any limitations when using functions in this way in a web form, or if there is a work around to this issue. 

Please let me know if you need me to go into any more detail.

Thanks,
Sam

0 Kudos
10 Replies
AzariahAnakin
New Contributor
I am also trying to use Symfony Form Component with Silex framework at the moment to try how to answer spam calls. I added some fields in buildform method of my form type class. Also user can click on a button and add unlimited textarea element using javascript on the frontend.
0 Kudos