Announcement

Collapse
No announcement yet.

NAB textarea field -> cr/lf

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • NAB textarea field -> cr/lf

    i have a NAB form with a text-area field, where multiple lines (by using the enter key.. ) can be entered..

    In the RPG call that is used for saving the data into the file, i'm using the vvin_json- procedure

    in the debug from the browser, i see the Json-string being sent, has "\n" as the CR/LF character..

    However in RPG.. as a result of the the vvin_json, the lines are showing just the "n"
    f.e i send 'line1\nline2' but after the vvin_json, in rpg, i'm receiving line1nline2 (the "" is missing)

    i noticed that in file on the iseries itself, should normally contain the X'25' as the CR/LF character.

    Can someone help in describing the best practice in handling CR/LF from within NAB?

    thx in advance

    i'm using
    PHP Code:
    vvIn.fieldName 'COMMENT';
    vvIn.totalSize = %size(dsComment:*all);
    vvIn.elementSize = %size(dsComment);
    numElements vvIn_JSON(vvIn:%addr(dsComment));
    For 
    ii1 to numElements;
      
    gParm_Comment dsComment(ii);
    Endfor; 
    [

  • #2
    Hi Thierry -

    How is the data for your textarea field being passed down from the browser? I assume that it is passing it down as one long string and not as a JSON object, correct? If so, vvIn_json would not be the appropriate method to retrieve the data. It would be vvIn_char.

    Comment


    • #3
      Hi Sean,

      that's the problem.. we're using the standard NAB ...
      which sends all data back to iseries in array ...[Rowxxx]

      what is the best way to retrieve this data in a RPG so that it doesn't lose the CR/LF (or \n) info...


      thx

      Thierry

      Comment


      • #4
        Hi Thierry -

        I assume that you are using the EXNABBTN template, correct? If so, the GetFormChar procedure.

        Code:
        d lComment        s         500a
         /free
          lComment = GetFormChar('COMMENT');
          // this will return the contents with the line feed hex code (x'25')
          //
          //  if you want to convert this to something else before saving to the database you can
          //   use %scanrpl and use the Valence provided "LF" (line feed constant)
          //
          lComment = %scanrpl(LF:'\n':lComment);
         /end-free

        Comment


        • #5
          indeed Sean... we were tried to achieve it with the standard VV_in procedures which was not giving the correct result...



          thx a lot for pointing is to the correct solution.., it is now working as we want it to...


          Thierry

          Comment

          Working...
          X