0

Update a field and jump in a record.

I have a JavaScript function used to do a update of a field and jump in a record.

---

function myClickTitleIntervention(id, url, valeurClick) { "{" }

    console.log("Start");
    var myElement = database.schema.typeOf(id);
    var myElementField = myElement.findElement("ValeurClick");

    database.loadNode(id, function (error, node) { "{" }
        if (error) alert(error);
           if (node){ "{" }
            var myNewValue = valeurClick;
            database.update( node._id, myElementField.id, myNewValue, (err) => { "{" }
                if (error) alert(error);{ "}" } );{ "}" }{ "}" });

    if (window.ui) ui.popupRecord(id);
    else alert(url);{ "}" }

---

 

This function work fine for many times. And now is broken, probably with the update of ninox. 

I tray to make same new fonction, but i can't find the database.schema inside the dom.

How can find the node of the DOM for making my update? 

Any help are welcome.

Robert

1 reply

null
    • dennis
    • 1 mth ago
    • Reported - view

    In the callback function paased to database.update, I suppose it should be

    if (err) alert(err);

    (err instead of error). That might not be the cause of the problem but it should help see what's happening. Were you able to fix it?

Content aside

  • 1 mth agoLast active
  • 1Replies
  • 71Views
  • 2 Following