Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @iskinderun

    Yes of course, but you will need to read the JSON from the external URL with some additional code.

    For example, assuming you want to populate the fieldname1 field in the form with this rate, you can insert a “HTML Content” field in the form with the following piece of code as its content:

    
    <script>
    fbuilderjQuery(document).one('showHideDepEvent', function(){
    fbuilderjQuery.getJSON( 'https://api.manana.kr/exchange/rate/KRW/USD.json', function(data){fbuilderjQuery('[id*="fieldname1_"]').val(data[0]['rate']);} );
    });
    </script>
    

    and that’s all.

    I’m sorry, but the support service does not cover the implementation of the users’ projects (forms or formulas). If you need additional help implementing your project, I can offer you custom coding service from my private website:

    https://cff.dwbooster.com/customization

    Best regards.

    Thread Starter iskinderun

    (@iskinderun)

    Oh great I’m crying. Thank you very much!

    • This reply was modified 6 years ago by iskinderun.

    fbuilderjQuery(document).one(‘showHideDepEvent’, function(){
    fbuilderjQuery.getJSON( ‘https://api.manana.kr/exchange/rate/KRW/USD.json&#8217;, function(data){fbuilderjQuery(‘[id*=”fieldname1_”]’).val(data[0][‘rate’]);} );
    });

    .val(data[0], how to change the 0 by fieldname input?

    Plugin Author codepeople

    (@codepeople)

    Hello @fatih71

    If you want to replace the number 0 with the value of a field in the form, for example, the value of the field 34, the code to use would be:

    
    fbuilderjQuery('[id*="fieldname34_"]').val()
    

    Best regards.

    Thank you, so it would be like this:

    fbuilderjQuery(document).one(‘showHideDepEvent’, function(){
    fbuilderjQuery.getJSON( ‘https://api.manana.kr/exchange/rate/KRW/USD.json&#8217;, function(data){fbuilderjQuery(‘[id*=”fieldname1_”]’).val(data[fbuilderjQuery(‘[id*=”fieldname34_”]’).val()][‘rate’]);} );
    });

    Plugin Author codepeople

    (@codepeople)

    Hello @fatih71

    Exactly, at least the structure is correct.

    Best regards.

    Thank you very much!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘filling form with JSON data’ is closed to new replies.