Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm using the HTML calculated column that's outlined on the pathtosharepoint blog, but I'm wondering, is there any way to create a calculated column, that displays a button/check box or anything that will update both my status and % complete columns at the same time?

So essentially a task complete button, which renders both my status as Completed and my % complete as 100%?

Thanks

Rob

share|improve this question
    
Crossposted here: endusersharepoint.com/STP/viewtopic.php?t=1961&p=7563#p7563 –  iOnline247 Oct 11 '10 at 12:38

2 Answers 2

up vote 1 down vote accepted

I would agree with Marc that a DVWP would be better in this case. I understand it is not an option for you.

Creating the button is the easy part, the problem is the onclick event handler.

Marc, the amount of script is not necessarily an issue, you can always put it in a function that will be called by the button. The main issue with calculated columns is that you cannot reference the item ID in the formula. You need a workflow trick to copy the ID to a standard field.

The bottom line is that it is not too difficult, but involves multiple steps/workarounds:

  • workflow to copy the ID
  • calculated column that creates the formula
  • text to HTML to display the button
  • externalize the onclick event handler in a function that calls the Web service to update the item.
  • and of course error handling along the way

Are you on SP 2007 or 2010?

share|improve this answer
    
Hi Christophe, Thanks for the advice I'm on Sharepoint 2007. The main problem is that the javascript code itself is too complex for me. Is there any where that I can get the steps you have mentioned above written for me? Thanks - Rob –  Rob Oct 11 '10 at 8:28
    
Rob, my advice is not to go down this route, it's not worth the trouble. If you still want to try, you should be able to find the different bricks on the Web (but not the whole procedure): - workflow to copy ID to ItemID - onClick='MarkComplete(itemID)' in your input formula - use a Web Service to write the MarkComplete function (certainly the SPServices documentation can help here) –  Christophe Oct 11 '10 at 15:06

IMHO, while what you're suggesting might be possible with an HTML calculated column, you're going to have something far more maintainable and sensical if you use a Data View Web Part (DVWP). Your button or link would need to have a decent amount of script in it and you might even run into a length problem with the column values.

share|improve this answer
    
Problem is I don't have access to SPD - does anyone know where I could get help with coding something like this? –  Rob Oct 9 '10 at 4:13
    
Marc-Would this be a good place to use your SPServices utilites? spservices.codeplex.com –  Rob Wilson Oct 9 '10 at 4:35
    
I've managed to get myself the button in to the list now by using this code: =CONCATENATE("<DIV><INPUT TYPE='button' NAME='myButton' VALUE=Complete onClick='alert(",",[Status],",")'></DIV>") Need to sort out the onclick to update both my [Status] and [% Complete] columns - any ideas? –  Rob Oct 9 '10 at 5:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.