Link to home
Start Free TrialLog in
Avatar of Techsavy
Techsavy

asked on

Form webpart connections

Hi,

I have a HTML form webpart that is customized so that it has a dropdown with list of values dynamically generated from a SharePoint list using Javascript client object model.

Attached (test.text)is my javascript that is loaded into a content editor webpart.

I have now created a 'HTML Form webpart' and customized so that the "option" elements are dynamically generated.

HTML form webpart code:

<div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_">
  <select id='pmsdiv' name='PM'>
  <option selected='selected'></option>
</select>  
  <input type="button" value="Go" onclick="javascript:_SFSUBMIT_"/></div>



AS you can see the javascript code in test.txt will add option elements dynamically in the Form webpart.

However, when i set up a webpart connection from HTML form webpart to another webpart on the same page, the data is not being sent to the consumer webpart.

Am not sure what I am doing wrong.

Anyhelp is appreciated., it is urgent
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Hi,
could you please add the attachment? Thanks.

KR
Rainer
Avatar of Techsavy
Techsavy

ASKER

Hi Rainer,

I have attached the code: and the corresponding form webpart code is below.

<div onkeydown="javascript:if (event.keyCode == 13) _SFSUBMIT_">
  <select id='mydiv' name='myField'>
  <option selected='selected'></option>
</select>  
  <input type="button" value="Go" onclick="javascript:_SFSUBMIT_"/></div>
Test.txt
ASKER CERTIFIED SOLUTION
Avatar of Rainer Jeschor
Rainer Jeschor
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Rainer,
Hi Rainer,

It looks like your code has lot of unused variables. Can you please check one more time
Hi,

attached the streamlined version - sorry have been really busy yesterday.

Comment on your initial script:
The form web part will modify the content during rendering by injecting some scripting stuff. Therefore your "mistake" has been that you replaced the complete content of the surrounding div and not only the select element.

HTH
Rainer
formsdrop.txt
Hi Rainer,

I dont think i was replcaing the "div" i was adding html for select element. As i mentioned with what i had i was able to get the values into dropdown. it is only when i select the value it is not being passed to the connected webpart.

Thank you for your detailed help,
The new issue i am seeing is ..the connection  is always sending first value in the dropdown.

so If i have item 1, item 2 in my dropdown, after I hit "Go", the dropdown is reverting to Item 1 , eventhough I selected "Item 2"
Well ..ultimately  I realized that if you have values populating into dropdown dynamically, the form webpart is unable to send values to the connected webpart.
Hi,
this is not true. I have simulated your code and in my case the form web part DOES send the filter to a connected list web part.
What is your target web part / filter consumer web part?

I have two lists, one with single select entries (like iRise, TTP, VS2010, TFS2010) and one other list which has these options as a choice column.

What field type is
- your select source list (text, user,...)
- your target column
?
Thanks

The more information about source list / target list/object you can provide the easier is the problem solving.

I am on the road - please be patient for responses.

HTH
Rainer
Hi Rainer,

The list i am binding the dropdown throu client object model is an external list.

and the data am sending to is also an external list view webpart.


So  I wonder this approach will not work with external lists?
Hi,
I am not sure, but imho it should work.
I would have to create also two external list in my dev environment, so please give me some time.

KR
Rainer
sure..i am also trying one more time with different external lists
Hi Rainer,

I tried and i was not able to send values on another external list. as well.

I think the webparts are communicating but an empty string is being sent to the consumer webpart.