Showing content when radio button is active

Home Forums Quform WordPress Showing content when radio button is active

This topic is: resolved
Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #24430
    Norbert
    Participant

    Dear Support team!

    I would like to crate a from where you can choose from 2 radio buttons.

    If i click one of the radio buttons then i can see the form input and elements attached to that radio button then i can fill all the required datas.

    and at the end i can submit those datas depending which radio button i chose.

    One would be for individuals and one for companies.

    I have attached an image what i would liek to achive.

    Can you please tell me how is it possible to do it?

    Thanks a lot for your help.

    Regards,
    Norbert

    Attachments:
    You must be logged in to view attached files.
    #24472
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24473
    Norbert
    Participant

    Hi thank you very much!

    I have additional questions:

    I have made the form ready where can i set the forms:

    action=”an URL added by me” and the method to be GET like this: method=”get” ?

    Another important thing to solve.

    I have an input field for numbers (cost) to be added. for example the value that the user can write in will be 100. I would like to multiply this value with 100 before pressing the submit button. So the value will be 100*100 at the end.

    the customer dont have to see this multiply.

    The form will take the customer to a new page where the form’s values are transferred to that form.

    Thank you very much for your help!

    best regards,
    Norbert

    #24506
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24512
    Norbert
    Participant

    Hi Ally!

    thanks a lot for your help!

    Yes i have checked that guide and already did it just wanted to ask if i can change the $_POST to $_GET in the plufin i made using your guide?

    This is because the other site script/form need the GET method as they write in the documentation.
    I have to pass ll the datas using your form to that form.

    thank you very much!

    #24520
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24533
    Norbert
    Participant

    Hi Ally,

    i have done the following:

    i inserted in the theme functions.php bottom area the following code you suggested:

    add_filter(‘quform_pre_process_1’, function (array $result) {
    $_POST[‘quform_1_3’] = $_POST[‘quform_1_3’] * 100;
    return $result;
    });

    then for the get method:

    add_action(‘quform_post_process_1’, function (array $result, Quform_Form $form) {
    $url = ‘http://www.example.com/?’ . http_build_query($_POST, null, ‘&’);

    wp_remote_get($url);

    return $result;
    }, 10, 2);

    the url is this where i must be redirected after the form submit: https://sklep.przelewy24.pl/zakup.php

    after these modifications i have the following problem: when i fill in every form inputs i get the error message for the pirice amount input text that it must contatin value, but i have wrote 300 for it.

    if i set the input field to be not necessary to fill out then after submit im not redirected.

    Can you please help me?

    here is the form i have implemented:
    webpage</p>

    thank you very much!

    • This reply was modified 6 years ago by Norbert.
    #24535
    Norbert
    Participant

    Hi Ally,

    here i write down everything to be more clear what i have to achive with your form:

    So i created a from with your plugin and the following values have to be given to another webpage’s form.

    This is the example form that they given to me with the documentation:

    
    <form method="get" action="https://sklep.przelewy24.pl/zakup.php"> 
    
    <input type="hidden" name="z24_id_sprzedawcy" value="YOUR_ID" />
    <input type="hidden" name="z24_crc" value="ORDERS_KEY" />
     <input type="hidden" name="z24_return_url" value="YOURWEBPAGE.PL" /> 
    <input type="hidden" name="z24_language" value="pl" /> 
    
    <table> 
     <tr> 
      <td align="right">Name:</td> 
       <td> <input type="text" name="z24_nazwa" value="payment" /> </td>
     </tr> 
     <tr> 
      <td align="right">Additional description:</td> 
      <td> <textarea name="z24_opis" style="width:250px">Additional info... </textarea> </td> 
    </tr> 
      <tr> <td align="right">To pay:</td> <td><input type="text" name="z24_kwota" /></td><!—AMOUNT*100--> 
     </tr> 
    </table> 
    
    <input type="submit" value="pay with przelewy24.pl" />
    
    </form>
    

    So the hidden input elements name have to be the same when i give the values with your form to the other webpage’s form.

    the input named “z24_kwota” is the amount i have t add in the input field and multiply it with 100 before sending to the other websites form.

    for example i write 100 inside then the value that i send it should be 10000.

    I have set up the form with your plugin and added the following codes to functions.php (later i add as a plugin if everything works well)

    
    add_filter('quform_pre_process_1', function (array $result) {
        $_POST['quform_1_21'] = $_POST['quform_1_21'] * 100;
        return $result;
    }); */
    
    add_action('quform_post_process_1', function (array $result, Quform_Form $form) {
        $url = 'https://sklep.przelewy24.pl/zakup.php' . http_build_query($_POST, null, '&');
    
        wp_remote_get($url);
    
        return $result;
    }, 10, 2);
    

    i have set the first add filters quform ID to the input field ID where you have to write inside the amount in this case it is 1_21.

    I have set your forms confrimations settings after the submit it should redirect to a custom URL.

    after doing these modifications it redirects to https://sklep.przelewy24.pl instead of
    https://sklep.przelewy24.pl/zakup.php.

    if i use the sample form insirted in the wordpress webpage then it redirects me to the actual page where it shoudl be redirected.

    i would like to use your great plugin for this task.

    thanks for your help!

    • This reply was modified 6 years ago by Norbert.
    • This reply was modified 6 years ago by Norbert.
    #24590
    Norbert
    Participant

    Hi Ally,

    is there any chance to get some help with this?

    this is my last quiestin then everything is set. I would really apprciate your help in this issue.

    thanks a lot!

    best regards,
    Norbert

    #24605
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24608
    Norbert
    Participant

    Hi Ally!

    thanks a lot for your answer!

    Theres one more thing after i did all you suggested.

    I have the following code(what you have told me in your last answer) inserted into function.php:

    add_filter('quform_pre_process_1', function (array $result) {
        $_POST['quform_1_21'] = (string) ($_POST['quform_1_21'] * 100);
        return $result;
    });
    
    add_filter('quform_post_process_1', function (array $result, Quform_Form $form) {
        $data = array(
            'z24_merchant_id' => 'ID',
            'z24_crc' => 'CRC_code',
            'z24_return_url' => 'https://www.egysziv.hu/adomanyozas/',
    		'p24_encoding' => 'UTF-8',
    		'z24_description' => 'Adományozás az Egy Szív a Gyermekekért Alapítvány részére',
    		'z24_country' => 'hu',
                    'z24_language' => 'hu',
    		'z24_currency' => 'HUF',
                    'z24_nazwa' => $form->getValue('quform_1_35'),
    		'k24_kod' => $form->getValue('quform_1_40'),
    		'k24_ulica' => $form->getValue('quform_1_41'),
    		'k24_email' => $form->getValue('quform_1_43'), 
            'z24_kwota' => $form->getValue('quform_1_21')
        );
    
        $url = 'https://sklep.przelewy24.pl/zakup.php?' . http_build_query($data, null, '&');
    
        return array(
            'type' => 'success',
            'confirmation' => array(
                'type' => 'redirect-url',
                'redirectUrl' => $url
            )
        );
    }, 10, 2); 

    I have filled everything correctly with the test ID-s and codes for the hidden fields.

    2 things happen:

    first is if at the following URL have the mark “?” after .php then the redirection takes me to the page: https://www.przelewy24.pl

    the code is :

    $url = 'https://sklep.przelewy24.pl/zakup.php?' . http_build_query($data, null, '&');

    if i remove the “?” mark after the php then i get the following error:

    image attached named “error.jpg”

    However if you take a look at this URL: https://www.egysziv.hu/teszt/

    just fill out the amount with a value then you will be redirected to the right page. (where i should be redirected with your plugin aswell)

    for this i have been using the sample form:

    <form method="get" action="https://sklep.przelewy24.pl/zakup.php"> 
    
    <input type="hidden" name="z24_id_sprzedawcy" value="YOUR_ID" />
    <input type="hidden" name="z24_crc" value="ORDERS_KEY" />
     <input type="hidden" name="z24_return_url" value="YOURWEBPAGE.PL" /> 
    <input type="hidden" name="z24_language" value="pl" /> 
    
    <table> 
     <tr> 
      <td align="right">Name:</td> 
       <td> <input type="text" name="z24_nazwa" value="payment" /> </td>
     </tr> 
     <tr> 
      <td align="right">Additional description:</td> 
      <td> <textarea name="z24_opis" style="width:250px">Additional info... </textarea> </td> 
    </tr> 
      <tr> <td align="right">To pay:</td> <td><input type="text" name="z24_kwota" /></td><!—AMOUNT*100--> 
     </tr> 
    </table> 
    
    <input type="submit" value="pay with przelewy24.pl" />
    
    </form>

    So actually i have been thinking what should cause this error and i was thinking about the URL syntax but im not sure.

    What do you think what should be changed?

    Thanks a lot for your support!

    regards,
    Norbert

    • This reply was modified 6 years ago by Norbert.
    • This reply was modified 6 years ago by Norbert.
    Attachments:
    You must be logged in to view attached files.
    #24643
    Norbert
    Participant

    Hi Ally,

    Sorry for writing again i know you have a lot of support requests. i just want to explain again so everything will be more clear but i think now only some small improvements left then everything will work perfectly.

    So i inserted all the codes you suggested in your last answer into functions.php

    With the normal form example i sent you and on the link you can give fake datas to test it out. THat from get me righ to that page where it supposed to.

    With your form i get redirected to their homepage isntead of the URL with the php file getting the datas transferred.

    I would really appriciate your help so i can finish this project.

    Thanks a lot for your great support!

    regards,
    Norbert

    #24660
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    #24664
    Norbert
    Participant

    HI Ally,

    Yes you are right i was not paying attention the name of the id was in english.

    Thanks a lot for your support. I really appriciate it.

    Awesome plugin you made.

    best regards,
    Norbert

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy