Multiple submits

Hi everyone!

I thought I would give you a way to handle multiple submits in a form. Lets say you have a form that should be filled by both students and ordinary attendees. There are some fields that are specific to the students like name of school and name of education and for the attendee we might have fields like title and name of company. When they make the submit we want to make sure all required fields are filled, but only the required fields for that kind of person.

First of all the person should make a decision if he is a student or an attendee, the form could look like this.

When the person clicks one of the buttons a field named listener is set to Attendee or Student. This decides which fields (or sections) that are displayed on the form. To handle the submit and validation of fields I have two submit buttons that looks the same but have different rules applied to them. They are both hidden if listener is blank or is set to the other buttons value.

Here is how it looks in design mode where both submit buttons can be seen and you also can see the message that is thrown if not all required fields are filled.

I think it’s a pretty easy way to accomplish what I was looking for and should be pretty simple for any one to use as well.

CU!

/Niax


Add a button to a repeating table to copy row data

Hi everyone!

I will show you how to add a button to a repeating table and be able to copy information from that row to other fields.

Create a list in SharePoint and name it Location with three columns, Title, Region and City.

Add a data connection to your form to receive information from this list in SharePoint. Now when you have your repeating table as a secondary source, highlight it and drag it to your form.

Put your cursor somewhere in the column for ID, right click and choose DeleteColumns, now you only have the Title, Region and City columns left.

Now put the cursor somewhere in the City column, right click and choose Insert – Columns to the right.

It should now look like this

Now add a button in the field next to the City field.

Add three Text Box fields somewhere in your form and name them MyTitle, MyRegion and MyCity.

Highlight the button and click Manage Rules in the ribbon. Create a new Action rule to set a field’s value. It should look like this.

The Value is built by adding the function current(), then a slash “/” and lastly, add the field Title from your secondary source Location.

Repeat this step twice so that you get a value for each of your three fields. You should now have three actions in your rule, like this.

That’s it, this is how it could look.

CU

/Niax

 


Need a link to create a new document from an Office template?

Hi everyone!

I found this blog post the other day and you can’t imagine the thrill I felt 🙂

This is something I have wanted to be able to do so many times and didn’t know how to, now I do and I want you to do as well.

As you can see (and read in the blog post) the saveLocation is set from where the template is located. I did a little change to route the save location to a place I decided. I also added a little change to wait until the page is loaded before the function is executed, always a good thing to do.

This is the original code:

<script type="text/javascript" src="/_layouts/jquery.min.js"></script>
<script type="text/javascript">
$( function () {
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
saveLocation = $(this).attr("href").split("/").slice(0, -2).join("/")
createNewDocumentWithProgID(window.location.protocol + '//' + window.location.host + $(this).attr("href"), window.location.protocol + '//' + window.location.host + saveLocation, 'SharePoint.OpenDocuments', false)
return false
})
})
</script>

and this is my modified one with a hard coded save location:

<script type="text/javascript" src="/Style%20Library/Scripts/jquery-1.4.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
createNewDocumentWithProgID(window.location.protocol + '//' + window.location.host + $(this).attr("href"), makeAbsUrl('http://MyIntranet/sitename/sitename/librar%20name'), 'SharePoint.OpenDocuments', false)
return false
})
})
</script>

Here is another one that prompts to save the document in the logged in users local Document library.

<script type="text/javascript">
$(document).ready(function(){
$("a[href$='.dot'], a[href$='.dotx'], a[href$='.xlt'], a[href$='.xltx']").attr("onclick", "").click( function () {
createNewDocumentWithProgID(window.location.protocol + '//' + window.location.host + $(this).attr("href"),'C:\Users\{login}\Documents' , 'SharePoint.OpenDocuments', false)
return false
})
})
</script>

As always when we are working with jQuery you have to make sure that you reference the location of that .js-file

CU

/Niax