Mar 24th, 2010, 10:19 AM (This post was last modified: Mar 24th, 2010, 10:23 AM by bvdveen.)
Hi all,
After weeks of tailoring quiet a complex form with about 92 validation rules I discovered that values chosen from a multiple select box are not submitted to the views within form tools.
The multiple values chosen from multiple selectbox B are preceded by a choice from a select box A (not multiple) that generates a list in checkbox B. (hope I formulated this clearly)
Somewhere in the documentation Ben mentiones that for checkboxes or multiple select boxes the field names must contain '[]' . I have searched and searched and could not find an answer in the documentation.
Yes, that's exactly it: PHP requires you to enter [] characters at the end of the name attribute value in order to let the server know to expect multiple values. e.g.
Mar 28th, 2010, 11:55 PM (This post was last modified: Mar 29th, 2010, 12:28 AM by bvdveen.)
(Mar 28th, 2010, 4:20 PM)Ben Wrote: Hi Bert,
Yes, that's exactly it: PHP requires you to enter [] characters at the end of the name attribute value in order to let the server know to expect multiple values. e.g.
But within Form Tools, the form name field should just be "myfield" (no square brackets).
This is again an odd PHP-ism.
So you've tried this without any luck?
- Ben
Hi Ben,
Thanks for your always so quick answer. I really like the way you treat messages in general....a compliment!
However...(as you might expect...;-).
First of all I do not use PHP (yet) in the form I mentioned. I do not (yet) make use of the Form Tools API. I only use HTML and rsv.js. Part of the rules (of in total 197 rules!) I apply follows below:
rules.push("required,date1,vul de datum in.");
rules.push("required,mw,hoe heet je?");
rules.push("required,pr_AZ,projectnaam goed invullen.");
rules.push("required,wrks_cat1,kies een werksoort.");
pr_AZ is a select box where users can pick a letter from the alfabet.
This triggers a javascript that via an array produces a list in a field 'pr_naam' : a multiple select box where users can select more values (with Ctrl) starting with the letter (A-Z) from 'pr_AZ'.
Problem is that those values do not appear within form tools.
Now:
1. where exactly do I make sure the field value has [] brackets?
2. in the rule? in the form field name? and how am I sure that within form tools the right field value(s) appear(s)?
3. Could the javascript used to automatically trigger the list in 'pr_naam' be the cause of the problem?
Mar 29th, 2010, 1:29 AM (This post was last modified: Mar 29th, 2010, 2:12 AM by bvdveen.)
I think the problem lies in the fact that the javascript mentioned produces the list and therefore is not 'seen' by formtools. Would it help to manually add form field values (as the form field select box pr_naam contains no values) ?
Thanks again!
(Mar 29th, 2010, 1:29 AM)bvdveen Wrote: I think the problem lies in the fact that the javascript mentioned produces the list and therefore is not 'seen' by formtools. Would it help to manually add form field values (as the form field select box pr_naam contains no values) ?
Thanks again!
I tested the form with formtools 1,51 and had no problems....
Quote:1. where exactly do I make sure the field value has [] brackets?
Even if your page is just HTML, any multi-select fields will need to have those brackets at the end of the select box's name attribute. So, your HTML would look like this:
Quote:2. in the rule? in the form field name? and how am I sure that within form tools the right field value(s) appear(s)?
I'm not quite following you here... but in terms of seeing the info in Form Tools, I'd suggest doing this: temporarily change the field type for the "pr_naam" within Form Tools to a textarea field. That'll be easiest to see what values are actually being stored by Form Tools for each form submission. Once it's been ascertained that it is indeed storing multiple values (separated by a ", "), you can go back and change it back to a multi-select field with the appropriate dropdown values.
Quote:3. Could the javascript used to automatically trigger the list in 'pr_naam' be the cause of the problem?
I really do think it's just a configuration problem in the form - Form Tools doesn't care HOW the form is actually created. You could use JS to construct the entire form - form element included! - as long as it receives a POST request, it's happy.
If you like, post me back with a link to the form and I could take a look to confirm the form looks okay.
Apr 8th, 2010, 12:33 AM (This post was last modified: Apr 8th, 2010, 12:36 AM by bvdveen.)
(Apr 3rd, 2010, 4:23 PM)Ben Wrote: Hey Bert,
Sorry for the wait!
Quote:1. where exactly do I make sure the field value has [] brackets?
Even if your page is just HTML, any multi-select fields will need to have those brackets at the end of the select box's name attribute. So, your HTML would look like this:
Quote:2. in the rule? in the form field name? and how am I sure that within form tools the right field value(s) appear(s)?
I'm not quite following you here... but in terms of seeing the info in Form Tools, I'd suggest doing this: temporarily change the field type for the "pr_naam" within Form Tools to a textarea field. That'll be easiest to see what values are actually being stored by Form Tools for each form submission. Once it's been ascertained that it is indeed storing multiple values (separated by a ", "), you can go back and change it back to a multi-select field with the appropriate dropdown values.
Quote:3. Could the javascript used to automatically trigger the list in 'pr_naam' be the cause of the problem?
I really do think it's just a configuration problem in the form - Form Tools doesn't care HOW the form is actually created. You could use JS to construct the entire form - form element included! - as long as it receives a POST request, it's happy.
If you like, post me back with a link to the form and I could take a look to confirm the form looks okay.
- Ben
Hi Ben,
I hope you had a nice Easter weekend!
As to my form...I hace tried all the possibilities you mentioned. Probably oversaw a small item!
Actually the problem lies in the names wrks_naam1[] and wkrs_naam2[]..
Thanks again for your reply!
Greetings
Bert
I will inculde a link to the form, as it is to big to post here I guess...
So did you figure it out? You mentioned you thought the problem lies in those field names? The markup you posted looks fine.
How about this part? Did you try this out?
Quote:I'm not quite following you here... but in terms of seeing the info in Form Tools, I'd suggest doing this: temporarily change the field type for the "pr_naam" within Form Tools to a textarea field. That'll be easiest to see what values are actually being stored by Form Tools for each form submission. Once it's been ascertained that it is indeed storing multiple values (separated by a ", "), you can go back and change it back to a multi-select field with the appropriate dropdown values.
Apr 10th, 2010, 10:58 PM (This post was last modified: Apr 10th, 2010, 11:15 PM by bvdveen.)
Hi Ben,
Thanks again for your answer.
It doesn't seem to work out...
When I submit the same form to formtools vs 1.51 I have no problems at all..maybe something I overlooked in general?
Oh, I must say three comma's appear in one of the mentioned multiple select fields...
Greetings
Bert
Hi Ben,
I might have resolved the problem!
I adjusted the field types to select and multiselect and then back to textarea...and now the fields are filled in!
Apr 12th, 2010, 1:11 AM (This post was last modified: Apr 12th, 2010, 1:13 AM by bvdveen.)
Hi Ben,
Sorry to bother you again...from your posts I know you must be very busy. Well so am I as you can see :-)
The so-called solution (better call it work-around I guess) I mentioned above works for FT 1.51 and for FT 2.0. Meaning: changing the multiple select fields within ft into text-area's solved the problem! (for me)
I would like to know however if the 'better' solution exists...
Also...couold you give me a hand with the reg_exp rule I tried to write mentioned above?
Quote:I would like users to give the opportunity to use a comma, I tried:
rules.push("reg_exp,aantal_groen,^\s*(0|1|2|3|4|5|6|8|9|\,\)\s*$,i,alleen cijfers en komma!");
it doesn't seem to work....the form submits without java errors....