Set Field Value in Velocity

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Set Field Value in Velocity

DeHaynes
OK, I think this one is going to be easy.  I have searched but I cannot find a solution.

I am trying to check if fields have values when the form is put in edit mode.  If they don't have values, then I want to give it a value which is the name of the document.  

  #if ($doc.getValue('processName').trim().length() == 0)
    #set($!processName="Bob")
    $!request.setParameter('processName', "Bob")
  #end

I do not get an error, but "$doc.display('processName')" input box has nothing in it.

P.S. In this code I just hard coded "Bob".  After I get this working, I will change it to get the document name.
Reply | Threaded
Open this post in threaded view
|

[Solved]Re: Set Field Value in Velocity

DeHaynes
Just one of those things where I needed to step away for a while.  Once I came back, I solved it in 2 minutes.


  #if ($doc.getValue('processName').trim().length() == 0)
    $doc.set('processName', $doc.name)
  #end