0
Why does the following javascript snippet that works in 10.1.1.3 not work in 10.1.5.1?

var text1 = GetFieldValue("TITLE");
SetFieldValue("DESCRIPTION", text1, "true");

(Included among post-upgrade questions in Serena case # 5471298)
Responses (14)
  • Accepted Answer

    Friday, May 29 2015, 10:17 AM - #Permalink
    0
    The javascript snippet is in a form action.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 10:50 AM - #Permalink
    0
    I have code like this in several places without a problem. I am running 10.1.5.1.

    Are you doing this in a form load event? If it is on form load try calling the same function with a button click action and see if it works.

    Roger
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 10:52 AM - #Permalink
    0
    sorry, just noticed I don't put quotes around "true" in my functions. You could try removing the quotes.

    wish I could edit my previous response...
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:07 AM - #Permalink
    0
    I tried both, although I'm not sure I did the click function correctly. The following doesn't work either:

    function copyField()
    {
    SetFieldValue("DESCRIPTION", GetFieldValue("TITLE"));
    }

    AddClickCallback("DESCRIPTION", copyField);
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:09 AM - #Permalink
    0
    The latter script works by itself. I had it in a form action so that I could test the title and description for being empty, but I'll try to incorporate those conditions into the javascript.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:12 AM - #Permalink
    0
    The conditions I want to duplicate are: When Description gains focus, if Title field isn't empty and Description field is empty (so as not to wipe out text in Descriptiont if the user decides to modify the Title), then...
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:13 AM - #Permalink
    0
    pb wrote:

    The conditions I want to duplicate are: When Description gains focus, if Title field isn't empty and Description field is empty (so as not to wipe out text in Description if the user decides to modify the Title), then...
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:14 AM - #Permalink
    0
    Incidentally, clicking the redo (or whatever it is) arrow on the upper right of the reply you just sent gives you an edit window, but doesn't apparently replace the reply you're editing.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:23 AM - #Permalink
    0
    I just added a field Test to an existing for and called the function when the Test field (equivalent to your Description field) gained focus. This is my function, worked fine:

    function testcopy()
    {
    var text1 = GetFieldValue("TITLE");
    SetFieldValue("TEST", text1, true);

    }

    I didn't put the check in to see if it was null, but that shouldn't make a difference. I do not have the Include jQuery plugin checkbox checked.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:28 AM - #Permalink
    0
    As I said, as a pure javascript, I have a copy function that works; the problem is in the snippet. I'm trying to get the syntax right for the two conditions so I can abandon the form action. What and where is the Include jQuery plugin checkbox? It sounds familiar, but I can't recall where it is.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 11:42 AM - #Permalink
    0
    I found the jQuery plugin checkbox; it is not checked.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 12:28 PM - #Permalink
    0
    You're over my pay grade on javascript support. :-)

    Not sure why you don't want to use a form action for gain focus - my understanding is it essentially registers the callback function for you and the action is the same. I never got callbacks to work correctly and use form actions exclusively.

    I'll defer to others that are more experienced in such details.

    Good luck!

    rj
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 12:32 PM - #Permalink
    0
    Thanks. I have no particular reason to want to use a form action, except that it saved me from figuring out what and how to use to test for fields being empty. Since I can't get the form action to work (yet), I'm sticking for now with the javascript.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 29 2015, 01:57 PM - #Permalink
    0
    This works:

    function copyField()
    {
    var emptyTitle = (IsFieldEmpty("TITLE"));
    var emptyDescr = (IsFieldEmpty("DESCRIPTION"));
    if (!(emptyTitle)) {
    if (emptyDescr) {
    SetFieldValue("DESCRIPTION", GetFieldValue("TITLE"));
    }
    }
    }
    AddClickCallback("DESCRIPTION", copyField);
    The reply is currently minimized Show
Your Reply

Recent Tweets