locked
Add string to list field while submitting a new form list data RRS feed

  • Question

  • I am trying to add a 'new comment' in the newform.aspx, there are two columns in that, named 'Title' and 'Body'. User will enter his 'title' as e.g, 'ABC'. I would like to add a constant string('Comment by') before 'ABC'.

    Once the user enter data in the 'Title' and 'Body', as 'ABC' and 'Some description'. I need to add a string before the 'Title'. So, final outcome should be 'comment by ABC'.

    I am wondering is there any OOTB solution for this or do I need to go for a custom solution.

    Please let me know, if you don't understand this question. I will try to explain it in a better way. Thanks in advance.

    • Moved by Mike Walsh FIN Tuesday, June 21, 2011 7:14 AM wants oob solution if possible so Admin q (From:SharePoint - Development and Programming (pre-SharePoint 2010))
    Tuesday, June 21, 2011 3:29 AM

Answers

  • You can create a calculated column in the list which stores its value as "Comment By" + your title column value (Formula will be "Comment by"&title).

    This will store the new text in the calculated column.

     

    check this link for knowing more about calculated columns : http://office.microsoft.com/en-us/windows-sharepoint-services-help/examples-of-common-formulas-HA001160947.aspx

     

    Or if you want to update the same column (title column) only, then you have to go for a event handler.

     

     


    Thanks,
    Chanakya
    Microsoft Certified Professional
    My Blog
    • Edited by Chanakya Jayabalan Tuesday, June 21, 2011 6:04 AM Added reference URl
    • Marked as answer by SPLearn24 Tuesday, April 3, 2012 4:44 PM
    Tuesday, June 21, 2011 6:03 AM
  • Hi Chanakya,

    Thank you for your reply and I am still looking for this solution.

    I would like to add the string, in the 'Title'.

    If the user enters 'Title' as 'ABC', then I need to add the string 'Comment by: ', so the final outcome will be 'Comment by: ABC'. I want to display this without using any calculated value.

    Is there any OOTB solution for this or do I need to go for the custom solution. Please help me here.

    • Marked as answer by SPLearn24 Tuesday, April 3, 2012 4:44 PM
    Wednesday, June 22, 2011 5:31 AM
  • Hi ,

    I would like to add the string, in the 'Title' field.

    If the user enters 'Title' as 'ABC', then I need to add the string 'Comment by: ', so the final outcome will be 'Comment by: ABC'. I want to display this without using any calculated value.

    Looks like 'Title' field is a default one, I dont think we can edit it and change its 'type' to calculated column.

    Is there any OOTB solution for this or do I need to go for the custom solution. Please help me here.

    • Marked as answer by SPLearn24 Tuesday, April 3, 2012 4:44 PM
    Wednesday, June 22, 2011 2:13 PM

All replies

  • You can create a calculated column in the list which stores its value as "Comment By" + your title column value (Formula will be "Comment by"&title).

    This will store the new text in the calculated column.

     

    check this link for knowing more about calculated columns : http://office.microsoft.com/en-us/windows-sharepoint-services-help/examples-of-common-formulas-HA001160947.aspx

     

    Or if you want to update the same column (title column) only, then you have to go for a event handler.

     

     


    Thanks,
    Chanakya
    Microsoft Certified Professional
    My Blog
    • Edited by Chanakya Jayabalan Tuesday, June 21, 2011 6:04 AM Added reference URl
    • Marked as answer by SPLearn24 Tuesday, April 3, 2012 4:44 PM
    Tuesday, June 21, 2011 6:03 AM
  • Thanks Chanakya, calculated column will work for me.
    Tuesday, June 21, 2011 2:37 PM
  • Hi Chanakya,

    Thank you for your reply and I am still looking for this solution.

    I would like to add the string, in the 'Title'.

    If the user enters 'Title' as 'ABC', then I need to add the string 'Comment by: ', so the final outcome will be 'Comment by: ABC'. I want to display this without using any calculated value.

    Is there any OOTB solution for this or do I need to go for the custom solution. Please help me here.

    • Marked as answer by SPLearn24 Tuesday, April 3, 2012 4:44 PM
    Wednesday, June 22, 2011 5:31 AM
  • Hi ,

    I would like to add the string, in the 'Title' field.

    If the user enters 'Title' as 'ABC', then I need to add the string 'Comment by: ', so the final outcome will be 'Comment by: ABC'. I want to display this without using any calculated value.

    Looks like 'Title' field is a default one, I dont think we can edit it and change its 'type' to calculated column.

    Is there any OOTB solution for this or do I need to go for the custom solution. Please help me here.

    • Marked as answer by SPLearn24 Tuesday, April 3, 2012 4:44 PM
    Wednesday, June 22, 2011 2:13 PM