Title: [Plugin: WordPress Form Manager] Dynamic Input Values
Last modified: August 20, 2016

---

# [Plugin: WordPress Form Manager] Dynamic Input Values

 *  Resolved [geoff67](https://wordpress.org/support/users/geoff67/)
 * (@geoff67)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/dynamic-input-values/)
 * I’m trying using a database table to update a number of selects dynamically through
   JSON, but the form won’t save the submitted data.
 * Here’s the set up:
    Form has a select (drop-down) registered via the plug-in 
   with a single dummy option.
 * The data page for this form shows the select as a column.. which is perfect.
 * My form on the front end is manipulated by javascript to update the select with
   new options, which are pulled from a database. This works. I’m even updating 
   the hidden input value to the new number of options within the select. (Noticed
   that when comparing to the default US States select, which is generated by the
   plug-in).
 * Javascript is also assigning 0-index values to all of the options, and adding
   the ‘selected’ attribute to the correct option.
 * On submit, however, the value for my dynamic select is not saved to the database(
   nor sent via email).
 * Tried digging through the plug-in to see what I’m missing, and I’m thinking I’ll
   have to push my items to the getter_script? A bit lost here, since I thought 
   I had covered everything… below is a snippet of userscripts.js that I think I
   need to modify:
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * Thanks for your help.
 * EDIT: I can’t share the link with you for confidentiality reasons, but I’ll try
   to share what I can.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [hoffcamp](https://wordpress.org/support/users/hoffcamp/)
 * (@hoffcamp)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/dynamic-input-values/#post-2215264)
 * The problem with the ‘select’ functionality as you are trying to use it is that
   the posted value is always the ‘value’ attribute of the option tag, which in 
   normal usage is just the index of the option. The FM script takes the index and
   puts the ‘text’ of the option into the database, but your select only has a single
   dummy option, so that is the problem.
 * What you could do is make a form with a ‘text’ form item instead of the ‘list’
   type, and then replace it with a select box with JS on the front end. Or make
   a hidden text, using conditions, and populate this value with a select box. Either
   way the posted value of the text item will be passed through to the database 
   unchanged (except for stripping HTML tags and security stuff). You could also
   hook into the ‘submit’ button, as long as you end up calling whatever it is that
   it calls by default, and use that to post the right value for the text field 
   based on the currently selected option. The only important part of the form items
   is the ‘name’ of the tag, which is usually the type name followed by a random
   string. As long as there is a post value associated with that name, everything
   should be fine.
 * I noticed in the code you posted that you are editing the ‘ajax’ version of the
   form submit, which isn’t used, and should have been removed. I was trying to 
   make a widget for forms, but never finished it.
 *  Thread Starter [geoff67](https://wordpress.org/support/users/geoff67/)
 * (@geoff67)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/dynamic-input-values/#post-2215282)
 * Thanks for the quick reply. I think I’ll try replacing a text input, because 
   hiding one would be a disservice to disabled visitors (duplicate fields).
 * The code I posted was unaltered from the source. I was just curious if I was 
   looking in the right spot for my jSON to tie in to… but apparently not.
 * That said, your third option of hooking into the submit button was what I was
   trying to find… how might I pass these values and push() them together into the
   array? (In this way, avoiding a text input type altogether)
 *  Thread Starter [geoff67](https://wordpress.org/support/users/geoff67/)
 * (@geoff67)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/dynamic-input-values/#post-2215294)
 * Replacing the text input worked. Thanks for the idea!
 * Code below if someone needs it… requires jQuery, though could be written without
   it
 *     ```
       var select_y = '#text-12345'; // Get the ID after creating the text input
       $(select_y).replaceWith('<select name="text-12345" id="text-12345" />');
       ```
   
 * Repeat as many times as necessary. I had 3.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: WordPress Form Manager] Dynamic Input Values’ is closed to new
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wordpress-form-manager.svg)
 * [Form Manager](https://wordpress.org/plugins/wordpress-form-manager/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-form-manager/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-form-manager/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-form-manager/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-form-manager/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-form-manager/reviews/)

## Tags

 * [json](https://wordpress.org/support/topic-tag/json/)

 * 3 replies
 * 2 participants
 * Last reply from: [geoff67](https://wordpress.org/support/users/geoff67/)
 * Last activity: [14 years, 10 months ago](https://wordpress.org/support/topic/dynamic-input-values/#post-2215294)
 * Status: resolved