Forum Replies Created
- AuthorPosts
patdundee
ParticipantHi Allan
Thanks you for your reply. You cannot change the background colour of the form in the Form / Settings / Style. I have tried placing customs css for the form outer and inner wrapper but that does not work.
I do not wish to create my own style of form as I am happy with the default ones, Hence my question
Using iPhorm light css3 (rounded), Theme – Uniform Default. For the background colour of the form, which css file(s) do I edit, and where can I change this so I can make it transparent, and, or, change the default BACKGROUND colour please?
Many thanks
Patrickpatdundee
ParticipantPHP Sessions with Quform in WP V4.2.4
Hi Guys
I have been working all day trying to use the posted data in a php session when redirecting to another page . It seems normal php sessions do not want to work properly. This is what i have now come up with. Quform or someone else may have another way for this, but i have found this to be very easy to implement1) install WP Session Manager
2) Edit your functions page where you are calling the data from the form in the redirect
Instead of building an array, at the top of the function enter the following$wp_session = WP_Session::get_instance();
Then create your session for each of the form elements you need
$wp_session['your session' ]= $form->getValue('iphorm_your_element);
You can create a different session for each form element
When you wish to call or display any of the sessions on a page or post put the following line at the top
$wp_session = WP_Session::get_instance();
You can then display any of your session wherever you need to and work with them.
Here is a short working sample after installing WP Session Manager
function mytheme_modify_form_redirect2($url, $form)
{
$wp_session = WP_Session::get_instance();
$wp_session['Forename' ]= $form->getValue('iphorm_1_1');
$wp_session['Surname'] = $form->getValue('iphorm_1_2');
$url = ('your url');
return $url;
}
add_action('iphorm_success_redirect_url_2', 'mytheme_modify_form_redirect2', 10, 2);
And on the page to call the elements and display them
$wp_session = WP_Session::get_instance();
echo $wp_session['Forename'];
echo $wp_session['Surname'];
Simple
Hope this helps
Patdundee
patdundee
ParticipantHi Guys
Any news on this one for me please
Many thanks
Patrick
patdundee
ParticipantHi Ally
Question
What if you have more than 1 form each having their own dropdown select boxes,
Would you just rename the function and calls to (for example)
mytheme_dynamic_dropdown_values_1
mytheme_dynamic_dropdown_values_2 etc. etc.
function mytheme_dynamic_dropdown_values_1($form)
{
$options = array();
$res=mysql_query("select * from table ORDER BY name ASC");
$value="";
$label="Please select a county";
$options[] = array('label' => $label, 'value' => $value);
while ($row = mysql_fetch_assoc($res)) {
$options[] = array('label' => $row['value'], 'value' => $row['value']);
}$dropdown = $form->getElement('iphorm_8_1');
if ($dropdown instanceof iPhorm_Element_Select) {
$dropdown->setOptions($options);
}
//mysql_close($conn);
}
add_action('iphorm_pre_display_8', 'mytheme_dynamic_dropdown_values_1');function mytheme_dynamic_dropdown_values_2($form)
{
$options = array();
$res=mysql_query("select * from table ORDER BY name ASC");
$value="";
$label="Please select a county";
$options[] = array('label' => $label, 'value' => $value);
while ($row = mysql_fetch_assoc($res)) {
$options[] = array('label' => $row['value'], 'value' => $row['value']);
}$dropdown = $form->getElement('iphorm_9_1');
if ($dropdown instanceof iPhorm_Element_Select) {
$dropdown->setOptions($options);
}
//mysql_close($conn);
}
add_action('iphorm_pre_display_9', 'mytheme_dynamic_dropdown_values_2');
patdundee
ParticipantThat worked 🙂
Many thanks once again for all your help 🙂
First class as always
Regards
Patrickpatdundee
ParticipantThis just leaves the message display after posting that is not disappearing when you do not use Ajax to post the form
P
patdundee
ParticipantMy thoughts were correct about the database
I have moved the table to the wp database and it now works correctly with both yours and XYZ snippets.
I think with an external database I will possibly have to add a separate connection into the wp db file for the external database and then reference this connection in any mySql statements that refer to the external tables.
regards
Patrick
patdundee
ParticipantHi Ally
The new release did fix the other issue 🙂patdundee
ParticipantHi Ally
With Debug it shows an interesting error
WordPress database error: [Table ‘My_Database.wp_comments’ doesn’t exist]
It is looking for wp_comments in the external database (which i am generating the dynamic select box from in your script)
This is most likely where the issue lies. as in the dynamic script I use a separate database.
Hmm tricky, i think with the script the table will possibly have to be in the wordpress database and not an external one.
What are your thoughts
Regards
Patrickpatdundee
ParticipantHi Ally
This is the code i use. This works until i use the script to generate the select box. (Table renamed)
if (isset($_REQUEST['iphorm_7_1'])) {
$id=$_REQUEST['iphorm_7_1'];
$res1=mysql_query("select * from myTable where County=$id");
$showNum=mysql_num_rows($res1);
if ($showNum>0) {
echo 'There are '.$showNum.' listed';
} else {
echo 'There are currently no shows listed for your chosen county';
}
}This code is called with the snippet (I have renamed it on here)
[xyz-ips snippet="My-Snippet"]
patdundee
ParticipantHi Ally
I have noticed one issue that this causes
If you go to HERE
You will see under the form i get an error saying “Please use a valid short code to call snippet.”
This is a php snippet inserted with XYZScripts PHP Code
Once you post the form it disappears and works fine. This code is just to display the results after a selection has been sent.
If i remove your function and manually enter some details into the select box i do not get this error.
Somewhere along the line the code that is dynamically producing the select option is causing this error for the php snippet.
Also found another small issue
Without Ajax post
When you first load the page the select loads the dynamic list with no issue. Once the form is posted it no longer produces the list in the select boxIt also stops the message display after posting the form from disappearing after the timeout.
With Ajax post
It produces the list each timeHave you any idea how this can be resolved please
Many thanks
Patrick- This reply was modified 11 years, 4 months ago by
patdundee.
patdundee
ParticipantHi Ally
Just to let you know the custom dynamic select works a treat.Many thanks
Patrickpatdundee
ParticipantLooking at the reference to sessions, as there is only one field where i require the data, then this is a possible option as I could kill the session once i have collected it to keep the server clean i suppose 🙂
patdundee
ParticipantHi Ally
On the form page I have some PHP code requesting the data the user enters. It then uses this data in its custom sql statement to search the external database and display the results under the submitted form.
This form is currently working here with Ajax selected so it would produce no results. Obviously without Ajax it does collect the data and produce results.
The county selection is at the moment hard coded into the selection field, this will change to dunamic produced now you have advised me of the script I can use in the previous question 🙂
The main reason I would prefer it to work with Ajax it because I think it is much better and more effective without a page refresh.
Kind regards
Patrick
- This reply was modified 11 years, 4 months ago by
patdundee.
patdundee
ParticipantHi Ally
Yes it works without ajax ticked.
I was hoping there was a way of capturing with Ajax selected, as when you create a non WP site and post any form to itself with Ajax you can collect the data from it.
Perhaps one to work on for your team 🙂
Many thanks
Patrick- This reply was modified 11 years, 4 months ago by
- AuthorPosts