<script src="http://code.jquery.com/jquery-latest.js"> </script> <script type="text/javascript"> _spBodyOnLoadFunctionNames.push("FillOrWait"); var maxTime = 1000; var waitPeriod = 500; var totalWait = 0; function FillOrWait() { if( $('input[title=OccupationField]').length==0 && totalWait<maxTime) { totalWait = totalWait + waitPeriod; window.setTimeout(FillOrWait,waitPeriod); } else { var valueField = getQuerystring("Occupation"); $('input[title=OccupationField]').val(valueField); } } function getQuerystring(key, default_) { if (default_==null) default_=""; key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regex = new RegExp("[\\?&]"+key+"=([^]*)"); var qs = regex.exec(window.location.href); if(qs == null) return default_; else return qs[1]; } </script>
Tuesday, 15 May 2012
Auto field update for Infopath in SharePoint (part 2)
This time I have used some Jquery to decrease the lines of code,
Labels:
Infopath,
JavaScript/JQuery
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment