Client-Side Form And Field Updating.

Jul 26, 2013 at 12:58 PM
This is a bit more general than just SPS, but I know you guys use SPS in some pretty fancy client based apps and I wanted to get some experienced opinions on this.

I'm working on a SP2007 site using SPS and JQuery (which are both fairly new to me) and need to do a fair amount of field manipulation. Usual kind of stuff get/set, clear, hide, readonly etc.

What's the best way of doing this? I have tried googling, but there's all sorts of different JS/CSS scripts, Codeplex projects, JS libraries etc.

I've used JS functions before to get the field as an object to manipulate, which works, but is a bit clumsy.

I noticed one of the examples in here uses:-
var subject = $("#feedback-subject-input input").val();
    var message = $("#feedback-message-input textarea").text();
Now I'm using JQuery, I guess I should/could be doing all this kind of stuff with that?

I think I've kind of answered my own question, and maybe just need to read up on JQuery more, but it'll be good to get some advice, or good advanced script examples/links etc.

Jul 26, 2013 at 1:34 PM
Yes, you'll end up with a bunch of jQuery (and pure JavaScript) around what you do with SPServices. Probably the best examples are what is in SPServices itself plus what people show in these discussions. I also have a lot of examples on my blog.

Jul 26, 2013 at 1:57 PM
Thanks. I'll have a look on your blog and the source code.

I was hoping you could just use a field name and operation in Jquery and it would magically work out the field type and what it needed to do depending on browser etc. But from what I've come across on google so far, it seems you have to handle each field type differently and it's still quite fiddly. Is that right?

I've used this before:-

Part II. fieldutility.js
Control the new and edit list forms of sharepoint.
  1. Hide/Readonly the field
  2. Get/Set the field value
  3. Link up two choice(drop down list) fields
  4. Link up two lookup fields
  5. Filter the lookup/choice field
  6. Check for the empty fields dynamicly in client
  7. Re-define save/cancel button action
It's quite nifty and worked well as I remember. It's a bit old now though. Is that something I should be using, or would JQuery be better?
Jul 26, 2013 at 2:10 PM
PS I just googled "marc sharepoint" to get your blog and 6 out of the top 7 results were all by you (your site, here and slideshare). Being on 1st name terms with google must be nice!
Jul 26, 2013 at 2:22 PM
This also looks useful:-

Any thoughts? Better or worse than JQuery?

Does anyone else use this, or any other JS libraries?

I'm just trying to suss out a clean and easy way to do all the form stuff.