Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

My name is Santosh and I am a sharepoint developer. I am developing a on boarding for my company using designer 2010. we dont have infopath services, just sharePoint foundation. When a new employee request is approved, it is followed by "employee software hardware checklist" which is followed by "New PC" Request and there are several other requests depending on the items selected in the checklist. I have used one big list for all these different forms. Only "New Employee Request" will be NewForm.aspx rest everything is EditForm.aspx.

My problem I have required columns in each different form which the requester must fill at each stage, since all columns are in one list i have not declared columns as a required fields. Is there anyway that I can validate these columns not be empty when the corresponding form is opened and instead of submit button I am using FormAction button to submit data.

any help is appreciative. Thanks a lot

share|improve this question
add comment

2 Answers 2

Sure, you can add an onclick event to your save buttons in SPD, and that link to a javascript function like:

function saveForm() {
var colName = "Your column name";
var type;
var yourColumnValue;
var submit = document.getElementById("ctl00_m_g_7f9b0338_d639_4e29_8f31_e3bc60099584_ff371_ctl00_DropDownChoice").value;    
if((this.Obj = $("select[Title='" + colName + "']")).html() !== null) {
    yourColumnValue = (this.Obj.find("option:selected").text());
} else if((this.Obj = $("input[Title='" + colName + "']")).html() !== null) {
    yourColumnValue = (this.Obj.attr("value"));  }  
if(affiliationValue == "") {
    alert("Your Alert Here.");
    return false; }

This is for a dropdown, but gives you a general idea for what you can do with it.

share|improve this answer
add comment

If you are using sp 2010 add a content editor webpart to the form and in ti add the JavaScript block and PreSaveAction function

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.