assign value to a field ( insert or edit/update) using assignment from javascript

I am looking for a simple example for putting a value in a field using javascript. I figure if I can get that to work, I may be able to do something more complex. ( I eventually want to put the user's geolocation lat and long into the database record to record their location).

So, in a table, there is a field called latitude. Exactly where would I put javascript to assign a value ( "12345") to this field?

I am looking for the simplest way to make this work. I tied the slider example in Custom Input Elements but couldn't get that to work. Also failed with Validation example. ( Spent many hours on this already!)

What exactly are the required steps to link up a field's value with the results of a javascript expression?

Thanks for the help!
Meryl
1 person has
this question
+1
Reply
  • The tutorial at http://codeontime.com/learn/business-... explains how to validate user input.

    A JavaScript business rule is configured to fire Before the command that matches Calculate, Update, or Insert.

    You need to implement a similar business rule that fires Before commands Update and Insert. There is nothing to validate though. Simply assign the values to your data fields. For example,


    if (navigator.geolocation)
    {
    var self = this;
    navigator.geolocation.getCurrentPosition(function(position) {
    self.updateFieldValue('Latitude', position.coords.latitude);
    self.updateFieldValue('Longitude', position.coords.longitude);
    });
    }
  • (some HTML allowed)
    How does this make you feel?
    Add Image
    I'm

    e.g. sad, anxious, confused, frustrated kidding, amused, unsure, silly happy, confident, thankful, excited indifferent, undecided, unconcerned