Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / September 2005

Tip: Looking for answers? Try searching our database.

Checkbox in Repeating Table Only Fires OnChange Event From Last ro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
liz-kma - 07 Sep 2005 01:07 GMT
Hello,

I have a repeating table bound to a local data source, Interviewer.  The
interviewer name is stored in interviewer and selected, a boolean field, is
stored as an attribute of interviewer.

Here's the local data structure:

Interviewers, Group
Interviewer, Repeating Element
   Selected, Attribute
   Email, Attribute
   Phone, Attribute

The problem I'm having is that clicking on the checkbox only fires the
validation event when you click in the last row.  And that event seems to be
correct.  But when you click on the checkbox in any other row, it does not
fire an event.

Has anyone seen this?  Is there something I'm missing?

Thanks,
Liz
Scott L. Heim [MSFT] - 07 Sep 2005 14:50 GMT
Hi Liz,

I wonder if the behavior you are seeing is caused by not having the
"correct row?" That's just speculation on my part but I would like to share
sample steps with you where the OnValidate event for my check box fires
each time. Try these steps and let me know the results:

- Create a new, blank InfoPath solution
- Add a Repeating Table with 2 columns (field1 and field2)
- Change field2 to a Check Box control
- Right-click on field2 and choose Properties
- Click the Data Validation button
- From the Events box choose OnValidate and click Edit
- You should see the following:

function msoxd_my_field2::OnValidate(eventObj)
{
    // Write your code here
}

- Add this code between the braces:

    var objField1 = eventObj.Site.parentNode.selectSingleNode("my:field1");
   
    if(objField1.text != "")
    {
        if(eventObj.Operation == "Insert")
        {
            XDocument.UI.Alert(objField1.text);
        }
    }

- Save the script, Preview the form, add data to field1 and click the check
box. In my results, the check box OnValidate event fires each time.

Let me know if this works for you...or if I completely missed the boat on
the behavior you are seeing! :-)

Scott L. Heim
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights
bratt - 07 Sep 2005 16:23 GMT
I had unexpected checkbox event firing when I had a repeating table
bound directly to a secondary datasource - IP assumed the data to be
readonly. I ended up copying the secondary datasource to a group on the
main datasource onload() and rebound the repeating table to the main
group. Events then worked as expected. I also removeChild nodes from
the holding group before submitting to keep the xml cleaner.
liz-kma - 07 Sep 2005 18:26 GMT
Hello Scott and Bratt,

Yes, Bratt, I'm experiencing a similar problem.  The event only fires from
the checkbox upon insertion (and likely deletion) in a repeating table
although, if it's the last row, it fires correctly all the time -- anytime
there is a change.  I assumed it might be a secondary data connection problem
and switched to storing the data on the local side.

But I still have the same problem.  Now I'm thinking it has to do with
values that are stored as attributes as I did have everything working with a
secondary data source previously when nothing was stored as an attribute.

I'm going to switch back to elements, avoid using attributes, and see if I
can get it working again...

Thanks,
Liz

> I had unexpected checkbox event firing when I had a repeating table
> bound directly to a secondary datasource - IP assumed the data to be
> readonly. I ended up copying the secondary datasource to a group on the
> main datasource onload() and rebound the repeating table to the main
> group. Events then worked as expected. I also removeChild nodes from
> the holding group before submitting to keep the xml cleaner.
liz-kma - 07 Sep 2005 19:52 GMT
Hi Bratt,

Now I've moved everything into local data using a repeating group with child
elements.  I'm still having the same problem.  The one thing I do notice is
that the XML that is automatically generated by appendChild has no line-wrap,
although the elements themselves are correct.

Are you cleaning up the xml in string format before you add it to the local
data source?  (Just asking you mentioned dropping child nodes...)

Thanks!

-- Liz

> I had unexpected checkbox event firing when I had a repeating table
> bound directly to a secondary datasource - IP assumed the data to be
> readonly. I ended up copying the secondary datasource to a group on the
> main datasource onload() and rebound the repeating table to the main
> group. Events then worked as expected. I also removeChild nodes from
> the holding group before submitting to keep the xml cleaner.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.