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

I have a custom list (serving as a change control form), which I'd like to tweak a little. my Jquery isn't my strongest suit, hance my asking you guys for help. I'd like to ask if it's possible to set field values on a form depending upon selections in another column. Specifically

  1. If DateField is Filled, Set ChoiceField to Specific Option
  2. If ChoiceField is a Specific Option, Prompt for DateField to be filled out (Can I cater for this in List Validation?)

Hope that's clear, please let me know if not and I'll be happy to try re-explain.

Thanks, Steven

share|improve this question

1 Answer 1

This is certainly all doable with jQuery. My personal preference is to use selectors like $("input[Title='My Field']") to get the fields I want. Both should be simple change functions:

$("input[Title='My Field']").change(function(){
  $("input[Title='My Other Field']").val("Something");
  //or any other type of logic, like:
  // if ($(this).val()=== "something"){$("input[Title='My Other Field']").val("Something");}
});

Point 2 would be something like:

$("input[Title='Conditional Field']").hide();
$("input[Title='My Field']").change(function(){
  alert("Please fill out this other field");
  $("input[Title='Conditional Field']").show();
});
share|improve this answer
    
Hi Eric, Thanks for the post. I'm going to try this tomorrow and will mark / ask as I go. Cheers, –  Steven D Andrews Jun 3 '13 at 16:58
    
No problem, without seeing your form code and whatnot, these are just general guidelines, the selectors are the key though. –  PirateEric Jun 3 '13 at 17:47

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.