web: fix js error on journal select field
This commit is contained in:
		
							parent
							
								
									a415759022
								
							
						
					
					
						commit
						43eee83c33
					
				| @ -379,7 +379,7 @@ addform _ vd@VD{..} = [hamlet| | |||||||
| 
 | 
 | ||||||
| journalselect :: [(FilePath,String)] -> HtmlUrl AppRoute | journalselect :: [(FilePath,String)] -> HtmlUrl AppRoute | ||||||
| journalselect journalfiles = [hamlet| | journalselect journalfiles = [hamlet| | ||||||
| <select id=journalselect name=journal onchange="journalSelect(event)"> | <select id=journalselect name=journal onchange="/*journalSelect(event)*/"> | ||||||
|  $forall f <- journalfiles |  $forall f <- journalfiles | ||||||
|   <option value=#{fst f}>#{fst f} |   <option value=#{fst f}>#{fst f} | ||||||
| |] | |] | ||||||
|  | |||||||
| @ -247,25 +247,6 @@ function addformDeletePosting() { | |||||||
|   if (focuslost) $('#addform tr.posting:last > td:first input:last').focus(); |   if (focuslost) $('#addform tr.posting:last > td:first input:last').focus(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function journalSelect(ev) { |  | ||||||
|   var textareas = $('textarea', $('form#editform')); |  | ||||||
|   for (i=0; i<textareas.length; i++) { |  | ||||||
|     textareas[i].style.display = 'none'; |  | ||||||
|     textareas[i].disabled = true; |  | ||||||
|   } |  | ||||||
|   var targ = getTarget(ev); |  | ||||||
|   if (targ.value) { |  | ||||||
|     var journalid = targ.value+'_textarea'; |  | ||||||
|     var textarea = document.getElementById(journalid); |  | ||||||
|   } |  | ||||||
|   else { |  | ||||||
|     var textarea = textareas[0]; |  | ||||||
|   } |  | ||||||
|   textarea.style.display = 'block'; |  | ||||||
|   textarea.disabled = false; |  | ||||||
|   return true; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| //----------------------------------------------------------------------
 | //----------------------------------------------------------------------
 | ||||||
| // SIDEBAR
 | // SIDEBAR
 | ||||||
| 
 | 
 | ||||||
| @ -314,15 +295,32 @@ function enableTypeahead($el, suggester) { | |||||||
|   ); |   ); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* | // function journalSelect(ev) {
 | ||||||
| // Get the current event's target in a robust way.
 | //   var textareas = $('textarea', $('form#editform'));
 | ||||||
| // http://www.quirksmode.org/js/events_properties.html
 | //   for (i=0; i<textareas.length; i++) {
 | ||||||
| function getTarget(ev) { | //     textareas[i].style.display = 'none';
 | ||||||
|   var targ; | //     textareas[i].disabled = true;
 | ||||||
|   if (!ev) var ev = window.event; | //   }
 | ||||||
|   if (ev.target) targ = ev.target; | //   var targ = getTarget(ev);
 | ||||||
|   else if (ev.srcElement) targ = ev.srcElement; | //   if (targ.value) {
 | ||||||
|   if (targ.nodeType == 3) targ = targ.parentNode; | //     var journalid = targ.value+'_textarea';
 | ||||||
|   return targ; | //     var textarea = document.getElementById(journalid);
 | ||||||
| } | //   }
 | ||||||
| */ | //   else {
 | ||||||
|  | //     var textarea = textareas[0];
 | ||||||
|  | //   }
 | ||||||
|  | //   textarea.style.display = 'block';
 | ||||||
|  | //   textarea.disabled = false;
 | ||||||
|  | //   return true;
 | ||||||
|  | // }
 | ||||||
|  | 
 | ||||||
|  | // // Get the current event's target in a robust way.
 | ||||||
|  | // // http://www.quirksmode.org/js/events_properties.html
 | ||||||
|  | // function getTarget(ev) {
 | ||||||
|  | //   var targ;
 | ||||||
|  | //   if (!ev) var ev = window.event;
 | ||||||
|  | //   if (ev.target) targ = ev.target;
 | ||||||
|  | //   else if (ev.srcElement) targ = ev.srcElement;
 | ||||||
|  | //   if (targ.nodeType == 3) targ = targ.parentNode;
 | ||||||
|  | //   return targ;
 | ||||||
|  | // }
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user