_input missing from submitted parameters

Mar 25, 2009 at 4:13 PM
As I understood, the widget creates two input fields - one for the input called $divname_input, where whatever the user typed in resides, and $divname_hidden, where the id of the corresponding JSON object is stored, or nothing if there is no matching JSON entry. however, when submitting the form, all I get is the value of the $divname_hidden field in the url string, which is submitted as a parameter with the title $divname. The example page led me to believe that a second parameter $divname_input would also be submitted, but it is not. Is this a bug or am I doing something wrong?

Thanks!
Coordinator
Mar 25, 2009 at 4:39 PM
The _hidden field is the only field currently submitted...but you can change what is stored in the hidden field, if you want something besides the id.

From the docs:
hiddenValue : string (default = 'id') : JSON property whose value is submitted when the form is submitted. Automatically updated whenever the displayValue changes.

This behavior is consistent with the html select tag, which only sends the option value (not the display text)...not that that's a good thing, necessarily!  :)

Let me know your use case, and why it's not covered with the hidden value, and I will evaluate whether to add an option to send the display value along with the hidden value when the form is submitted.

Thanks,
Noah
Mar 26, 2009 at 10:59 AM
Edited Mar 27, 2009 at 8:48 AM
Wow, thanks for the speedy response!
It's not really about which field is submitted (id/name), but about the behaviour when an item that is not in the list is entered.
To illustrate the point:

$('#combo').flexbox({  
                     "results": [  
                         { "id": "1", "name": "Ant" },  
                         { "id": "2", "name": "Bear" },  
                         { "id": "3", "name": "Cat" }
                     ], "total": 3 
                 }, {  
                     allowInput: true,  
                     paging: false
                 });

If the user enters "Cat", then "3" is submitted, which is what I expect, since it's in the list.
But if the user enters "Turtle", nothing is submitted because "Turtle" is not in the list. I would expect the flexbox to realize that and just submit whatever the user typed. Right now typing "Turtle" and submitting gives me an empty parameter.

I posted the original question because on the example page (http://www.fairwaytech.com/flexbox/Demos.aspx), example 9 has this note:
"If a new value is entered into the input box, and the form is submitted, the "ffb9" form field will be an empty string, since there is no corresponding "id" value. To access the typed-in value when the form is submitted, check for "ffb9_input" in the posted form variables."

Thanks for your help!

Jun 10, 2009 at 8:34 PM

I am also trying to enable this same functionality. I need to be able to access the value typed into the _input textbox if it isn't in the list. Anyone know how to do this?

Jun 10, 2009 at 11:15 PM

I have been able to get this to work:

$('#fb').flexbox('/gse/cms?command=getLookUpJson', {minChars: 2, autoCompleteFirstMatch: false, onSelect: function() {this.wasSelected = true;}});
$('#fb_input').focus(function() { this.wasSelected = false;} ); 
$('#fb_input').blur(function() { if(! this.wasSelected) $('#fb_hidden').val(this.value); } );

It seems that this could be patched into flexbox, the onSelect part in the selectCurr function and the focus and blur methods in the construction of the input box.However, I haven't been able to get that to work yet.

 

 

Mar 10, 2010 at 6:14 PM

Thanks dsevans93! I too was trying to figure out how to make use of a user input that was not from the selection list. I modified the code slightly from yours by prefixing the user input with an "X" to uniquely identify it as user input and not a possible selection value (all of my selection values are numerical).  The code change is:

$('#fb_input').blur(function() { if(! this.wasSelected) $('#fb_hidden').val("X"+this.value); } );

Mar 25, 2010 at 11:12 PM
Quite welcome. Dear flexbox author/maintainer: Any word on incorporating this feature?


On Wed, Mar 10, 2010 at 11:15 AM, NHwoods <notifications@codeplex.com> wrote:

From: NHwoods

Thanks dsevans93! I too was trying to figure out how to make use of a user input that was not from the selection list. I modified the code slightly from yours by prefixing the user input with an "X" to uniquely identify it as user input and not a possible selection value (all of my selection values are numerical).  The code change is:

$('#fb_input').blur(function() { if(! this.wasSelected) $('#fb_hidden').val("X"+this.value); } );

Read the full discussion online.

To add a post to this discussion, reply to this email (flexbox@discussions.codeplex.com)

To start a new discussion for this project, email flexbox@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com