Spaces in List Names using getSPListFields

Nov 2, 2009 at 3:28 AM

I am trying to get list contents dynamically so I can build dynamic lookup tables and help "Bubbles". I am able to use setSPObject(url,listname), but when I call getSPListFields(); it fails for any list with a blank in the list name. I have tried every permutation I can think of (case, escaped blank, missing blank, etc.) without success. What am I missing here. Do I need to rename my listnames to have no blanks?

Nov 3, 2009 at 1:01 AM

What version are you using? List names with spaces works fine for me in version 0.6 of jPoint.  What is your list name and the URL to the your NewForm.aspx page? Maybe someone can help.

Keep up the great work, guys.  This library kicks ass.

Coordinator
Nov 3, 2009 at 10:05 PM

I just implemented a setSPObject(url, listname) with spaces on one of my lists.

Just make sure to use 0.6 version of jPoint.

In version 0.6 there was a fix for spaces in the list name as well as fix for renamed lists.

Nov 4, 2009 at 3:52 AM

Samir,

I am using 0.6 version of jPoint. Running against the list "testlist" works. Running against "test list" against list named "test list" fails.  URL for the newform page is http://{sharepoint URL}/HPSS-Equipment/Lists/BU%20Reference/NewForm.aspx . Here is a clip of the code...

var buRef = jP.Lists.setSPObject("//{sharepoint URL}/HPSS-Equipment", "BU Reference"); // this works fine
buRef.getSPListFields();  // this fails

// I have also tried the following with every permutation I can think of...
// BUREFERENCE, BU Reference, BU%20Reference, BU_x0020_Reference, etc.
jP.Lists.{listname}.getSPListFields(); 
Coordinator
Nov 4, 2009 at 3:58 AM

I will try to recreate exact link structure on sharejpoint demo site and will get back to you ASAP.

I am thinking that dash in the URL might have to do something with it.

Thank you for feedback.

Will post results here.

If this happens to be a bug we will roll it into version 0.7 rolling out next Monday.

Nov 4, 2009 at 4:03 AM
Edited Nov 4, 2009 at 4:03 AM

Samir, I don't think it is the dash as the code works fine for a list named "testlist" in the same sharepoint site. The only corner case I can think of is where the code for handling the space is confused by the dash. Also note that the dash is part of the site name, not the list name.

Coordinator
Nov 4, 2009 at 4:25 AM

You are right about the dash! Dash is working just fine. The problem is following:

jP.Lists.{listName} where listname has space in it.  So jP.Lists.BU Reference is invalid javascript.

Here is what will work:

jP.Lists.setSPObject(jP.SiteURL, jP.ListName);

jP.Lists[jP.ListName.toUpperCase()].getSPListFields();

If you paste these two lines it should work for you. jP.SiteURL and jp.ListName jPoint reads on its own and available to users as long as they are on List Form page, kinda nice ha?

Let me know if this helps you towards your project?

-Samir

Coordinator
Nov 4, 2009 at 4:35 AM
Great discovery. jPoint should return an object that can then be used to get the list fields. That definitely makes sense. Essentially, we need to look at all use cases when we allow daisy chaining.

-Will
Sent from my Verizon Wireless BlackBerry
Nov 4, 2009 at 6:30 AM

I had a compounding problem.... The issue was that I used a variable name to store the object returned by setSPObject() that was getting stepped on by another script. So simplifying to the smallest case allowed the script to work as advertised. Changing the returned object variable name fixed the problem. Sorry for the goose chase. But I did learn an important technique by Samir on the indirect reference. Thanks for the help! I am now happily pulling off list data to dynamically build my drop-down lists. Next major learning curve=settting mouseover events on my form fields. I will be leveraging the HideFormFields code for that!

Coordinator
Nov 4, 2009 at 6:41 AM

If you are working on building drop-down lists, this discussion thread may help you.  I just created the thread "Stumbling around with dropdowns" from an e-mail conversation earlier this week.

http://jpoint.codeplex.com/Thread/View.aspx?ThreadId=74002

-Will