Group Abstract Group Abstract

Message Boards Message Boards

0
|
10.7K Views
|
2 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Validation in WebForm before next is pressed

Posted 11 years ago
2 Replies

Chad,
Forgot to thank you for this answer. Worked really nice. I was able to generate a 90 questions webform questionnaire. The only thing I learned is not to use pictures in a multipage webform FormLayoutFunction (slow "next" response). The picture code expression gets multiplied by the number of steps it has. Its better to ling using IMG tags to pictures on another website.

Since there are only 3 "ordinates" with 3 choices each, there are only 6 possible permutations for each variable (v1 and v2). So how about a different type of form that doesn't require any checks on the selected values? Something like below. Note that my form labels are ugly. I'm sure you could come up with a nicer way to present the options.

In[26]:= perms = Permutations[{0, 1, 2}];
In[27]:= labels = Permutations[{"Most", "Least", "Excluded"}];
dir = {"x=", "y=", "z="};
opt = dir[[1]] <> #[[1]] <> " " <> dir[[2]] <> #[[2]] <> " " <> dir[[3]] <> #[[3]] & /@ labels

In[31]:= FormFunction[{FormObject[<|
     "v1" -> <| "Interpreter" -> 
        Table[opt[[i]] -> perms[[i]], {i, Length@perms}], 
       "Control" -> RadioButtonBar, "Default" -> perms[[1]]|>|>], 
   FormObject[<|
     "v2" -> <| "Interpreter" -> 
        Table[opt[[i]] -> perms[[i]], {i, Length@perms}], 
       "Control" -> RadioButtonBar, "Default" -> perms[[1]], 
       "Control" -> RadioButtonBar, "Default" -> 0|>|>]}, Identity ][]

Out[31]= <|"v1" -> {0, 2, 1}, "v2" -> {2, 1, 0}|>
POSTED BY: Chad Knutson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard