I am using the image onload method to populate a value into a field. I go to save the record it says its blank even though there is a value populated into the the form.

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

There is definitely a value in there, but I get the "Serial is a required field.  Required fields may not be blank." 

The field I am trying to populate is the key field but we have a certain way of doing the value.  If I can't use the image onload technique this is going to be a huge pain. 
Photo of Jonathan

Jonathan

  • 0 Points

Posted 3 years ago

  • 0
  • 1
Photo of Jonathan

Jonathan

  • 0 Points
**Solved**  If you are using this method to populate a custom key field on the form, it will not work.  You have to use another pre populated key field instead.
Photo of Scott

Scott

  • 334 Points 250 badge 2x thumb
Jonathan,
Thanks for the follow up.  I'm actually using standard QB API to populate a value into a custom key field and it does not work either.  My work-a-round was to use another field and then push the data over using form rules.  I wonder if there is a technical reason for this.
Photo of Jack

Jack, Champion

  • 50 Points
  var url = "";


  url += "bh5544y5v";

  url += "?act=API_GenResultsTable&apptoken=57ma4bcf451451445cy7c7r6";

  url += "&query={27.TV.18}";

  url += "&clist=194";

  url += "&jsa=1";

  $.getScript(url, function () {

      $("#tdf_0").html(_.flatten(qdb_data).join(" "));

 var ms= //*[@id="tdf_0"]/text();  

 var url = "";

  url += "bh5544y5v";

  url += "?act=API_EditRecord&apptoken=57ma4bcf451451445cy7c7r6";

  url += "&fid=199" + //*[@id="tdf_0"]/text();

  url += "&jsa=1";

  $.getScript(url, function () {

    ();

  });



This code generates a table then takes the value from it and adds it to a field, which can then be saved. One of our IT guys wrote this for me so I don't have much knowledge on how it works but it may help you solve the problem using the image onload technique.
Photo of Jonathan

Jonathan

  • 0 Points
Thanks Jack, unfortunatey this isn't necessarily what I am looking for.  it would work for using this within a custom button on the homepage but not so much on a key field.  If you use the standard record id as the key field then sure, but if you are trying to use a custom formula field as the key field then no so much on the add record screen.  I could do it on save possibly, but I ended up finding another solution.
Photo of Jack

Jack, Champion

  • 50 Points
No worries, it might be useful someone else searching for an answer. Sorry it didn't help in your case.