1. NOTICE: If you are using Fabrik and update to Joomla 3.10, you will need to update to Fabrik 3.10. And, if you are using Fabrik, do not upgrade to Joomla 4, we do not have a supported version ready for release. More information on a release date coming soon. Also, please note that Fabrik 3.10 will not install on any Joomla sites less than 3.8.
    Dismiss Notice

Form plugin / conversion of form to JSON

Discussion in 'Community' started by smalldragoon, Mar 26, 2020.

  1. smalldragoon

    smalldragoon Member

    Level: Community
    Hi,
    I would need to convert/translate the form I'm submitting to JSON ( to send it to something else )
    Is there a way to do this ? I searched into the form plugins but nothing related I think
    Thanks for your insights
    Lionel
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    You can do whatever you want with a php plugin.
     
  3. smalldragoon

    smalldragoon Member

    Level: Community
    yes, it was to check if I was not missing something and the job was not done already....
    it happens that finally, I need it in Javascript before the submission,
    here is below some code for benefits of the forum if it can help someone !
    thanks


    var params = '{';
    for( var i=0; i<document.form_1.elements.length; i++ )
    {
    var fieldName = document.form_1.elements.name;
    var fieldValue = document.form_1.elements.value;

    params += '"' +fieldName + '":"' + fieldValue + '",';
    }
    params = params + '}';


    where form_1 is the name of your form....
     
    juuser likes this.

Share This Page