Forum Replies Created
- AuthorPosts
lawrencepepper
ParticipantSorry for the late response, was out for the past week.
Tried this but nothing shows, no errors.
L
lawrencepepper
ParticipantOK, found out how to do it, but would love to see the feature added in the next release to have the option for form data to be sent along with the re-direct.
L
lawrencepepper
ParticipantWould love:
1. Ability to Duplicate fields or groups.
2. Better database integration. Populate drop down boxes from a table/query, populate field default values from a table/query, allow updating of tables with submissions – not just inserting new data.
3. Dynamic default values update while person fills in form. Example, if I have a drop down populated by a query from a database, depending on what value a person selects in the drop down the rest of the form field’s default values would be populated on the fly from the query that populated the drop down.
4. Conditional successful submission messages. Some forms may do a number of things, would love to set the successful submission message to display different messages depending upon what may be checked/selected in a certain field.
I would upgrade immediately and pay more for this.
lawrencepepper
ParticipantNever mind,
Fixed.
Thanks again for the help.
L
lawrencepepper
ParticipantHave a small issue that has come up…
I am using this code to send some of the form data to a script. One of the data fields is the dropdown box from above that is being dynamically filled.
function mytheme_post_to_another_script($form)
{
// Rewrite the post variables
$post = array(
'vendor' => $_POST['iphorm_3_3'],
'newvendor' => $_POST['iphorm_3_7'],
'rep' => $_POST['iphorm_3_8'],
'delete' => $_POST['iphorm_3_11'],
);// Create a new cURL resource
$ch = curl_init();// Set URL and other appropriate options
curl_setopt($ch, CURLOPT_URL, 'http://test.gen-techno.com/scripts/vendorupdate.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post));// Grab URL and pass it to the browser
curl_exec($ch);// Close cURL resource, and free up system resources
curl_close($ch);
}
add_action('iphorm_post_process_3', 'mytheme_post_to_another_script', 10, 1);
Now the script no longer works, what is the name of the field string that is now being passed of the drop down, I believe it is not being passed as defined above any longer…
lawrencepepper
ParticipantWas thinking same thing. Just fixed. I did not have the Mysqli dll extension enabled in my php.ini file.
Works like a champ now.
Thanks so much for all the help!
L
lawrencepepper
ParticipantGetting the error:
Fatal error: Call to undefined function mysqli_connect() in C:\Users\Administrator\Documents\Websites\QAData\wp-content\themes\dejavu\functions.php on line 46
Not sure why it is failing now. When I tested just the query and array it returned results fine.
L
lawrencepepper
ParticipantOoops. Fixed that but now the page displays blank.
I am using the code:
function enterreport_dynamic_dropdown_values($form)
{
$options = array();
$dbc = mysqli_connect('localhost', 'xxx', 'xxx', 'qa');
$query = "SELECT * FROM qa_vendors";
$result = mysqli_query($dbc, $query);while ($row = mysqli_fetch_assoc($result)) {
$options[] = array('label' => $row['company'], 'value' => $row['company']);
}$dropdown = $form->getElement('iphorm_1_5');
if ($dropdown instanceof iPhorm_Element_Select) {
$dropdown->setOptions($options);
}
}
add_action('iphorm_pre_display_1', 'enterreport_dynamic_dropdown_values');
lawrencepepper
ParticipantOK,
Used the code and tested it. It returns:
Array ( [0] => Array ( [label] => UAB [value] => UAB ) [1] => Array ( [label] => Carleton [value] => Carleton ) [2] => Array ( [label] => Kinsley Inc. [value] => Kinsley Inc. ) [3] => Array ( [label] => Rumsey Eelectric [value] => Rumsey Eelectric ) [4] => Array ( [label] => Cooper Power Division [value] => Cooper Power Division ) [5] => Array ( [label] => Allied Electronics [value] => Allied Electronics ) [6] => Array ( [label] => Dave Inc. [value] => Dave Inc. ) [7] => Array ( [label] => KBI [value] => KBI ) [8] => Array ( [label] => Large Systems [value] => Large Systems ) [9] => Array ( [label] => Ace Hardware [value] => Ace Hardware ) )
BUT, it is still not showing up in the dropdown on the form.
lawrencepepper
ParticipantOK ,
Thanks.
L
lawrencepepper
ParticipantOK I think I am going crazy, found some more errors… Had my connect statement wrong, eiether way still not working…
function mytheme_dynamic_dropdown_values($form)
{
$options = array();
$dbc = mysqli_connect('localhost', 'user', 'paswword', 'qa');
$query = "SELECT * FROM qa_vendors";
$result = mysqli_query($dbc, $query);while ($row = mysqli_fetch_assoc($result)) {
$options[$row['company']] = $row['company'];
}$dropdown = $form->getElement('iphorm_1_5');
if ($dropdown instanceof iPhorm_Element_Select) {
$dropdown->setOptions($options);
}add_action('iphorm_pre_display_1', 'mytheme_dynamic_dropdown_values');
}
lawrencepepper
ParticipantI noticed some errors in the above code, fixed it but it still is not working…
{
$options = array();
$dbc = mysqli_connect('localhost', 'root', 'password', 'user');
$query = "SELECT * FROM qa_vendors";
$result = mysqli_query($dbc, $query);while ($row = mysqli_fetch_assoc($result)) {
$options[$row['company']] = $row['company'];
}$dropdown = $form->getElement('iphorm_1_5');
if ($dropdown instanceof iPhorm_Element_Select) {
$dropdown->setOptions($options);
}add_action('iphorm_pre_display_1', 'mytheme_dynamic_dropdown_values');
}
lawrencepepper
ParticipantHello,
I think I am close. I am using this but it is not populating the drop down.
function mytheme_dynamic_dropdown_values($form)
{
$options = array();
$dbc = mysqli_connect('localhost', 'root', 'password', 'user');
$query = "SELECT * FROM qa_vendors";
$result = mysqli_query($dbc, $query);
$data_array = array();
while ($row = mysqli_fetch_assoc($result)) {
$data_array[$row['company']] = $row['company'];
}$dropdown = $form->getElement('iphorm_1_5');
if ($dropdown instanceof iPhorm_Element_Select) {
$dropdown->setOptions($options);
}add_action('iphorm_pre_display_1', 'mytheme_dynamic_dropdown_values');
}
In the form builder I have one option set for the dropdown as it will not et me add the element without an option. Is this the correct way to set up the form for this code to work?
L
lawrencepepper
ParticipantOk,
That worked but now that I am using it I did not think this through properly. What I am doing is building a custom web app. I have a form that people fill out, one of the elements is a Company drop down. What I need is for that drop down to dynamically populate itself with all the company names in one of my database tables. There is another form on the site which allows people to add companies to the database. When they do this the dropdown on the other form needs to refelect this without me having to go in to QUFORM and re-configure that drop down box.
Any possible way of accomplishing this?
L
lawrencepepper
ParticipantGot it to work!
used this code:
function mytheme_bulk_options($options)
{
mysql_connect('localhost', 'xxx', 'xxx');
mysql_select_db('qa');
$query = "SELECT * FROM qa_vendors";$result = mysql_query($query);
$options['Companies'] = array();
while ($row = mysql_fetch_assoc($result)){
$options['Companies'][] = $row['company'];
}
return $options;
}
add_filter('iphorm_bulk_options', 'mytheme_bulk_options');?>Thanks!
L
- AuthorPosts