我正在尝试使用jQuery做一个简单的事情:每当表单加载时,或者如果用户更改选项列表,清除div中一组输入字段的输入字段; 但我有一个时间让选择器工作的魔鬼.
首先,这是我的onclick和onload触发器:
<form name="EditGenotype" action="process_GenotypeMaint.php" method="POST" onsubmit="return false" onload=clear_fetch() >
Run Code Online (Sandbox Code Playgroud)
并在选项列表上:
<SELECT multiple size=6 NAME="marker" onchange=show_marker() onclick=clear_fetch() >
Run Code Online (Sandbox Code Playgroud)
接下来,这是我想要清除的div中的HTML输入元素:
<div class=fetch_results>
<fieldset>
<LEGEND><b>Edit Genotype, call 1</b></LEGEND>
<boldlabel>Allele_1</boldlabel><input id=allele_1_1 name=allele_1_1 size=5 >
<boldlabel>Allele_2</boldlabel><input id=allele_1_2 name=allele_1_2 size=5 >
<boldlabel>Run date</boldlabel><input id=run_date1 name=run_date1 size=10 disabled=true>
</fieldset>
<fieldset>
<LEGEND><b>Edit Genotype, call 2</b></LEGEND>
<boldlabel>Allele_1</boldlabel><input id=allele_2_1 name=allele_2_1 size=5 >
<boldlabel>Allele_2</boldlabel><input id=allele_2_2 name=allele_2_2 size=5 >
<boldlabel>Run date</boldlabel><input id=run_date2 name=run_date2 size=10 disabled=true>
</fieldset>
<fieldset>
<LEGEND><b>Edit Genotype, call 3</b></LEGEND>
<boldlabel>Allele_1</boldlabel><input id=allele_3_1 name=allele_3_1 size=5 >
<boldlabel>Allele_2</boldlabel><input id=allele_3_2 name=allele_3_2 size=5 …Run Code Online (Sandbox Code Playgroud) 我正在通过Michael Hartl的优秀教程,但在尝试使用以下命令准备测试数据库时:bundle exec rake db:test:prepare我收到此错误消息:
错误:必须是数据库sample_app_test的所有者...
这是我在使用开发数据库时从未获得的,因为我为我的Rails应用程序创建了以下数据库角色:
CREATE ROLE demo_app WITH CREATEDB LOGIN
(这是使用Postgresql)
有谁知道为什么这在测试环境中失败了?TIA ...
我是jQuery语法的新手,这可能是一个真正的noobie问题....但是我只是不明白为什么我在加载此页面时会收到错误“ $ .effects is undefined”。如果有人能看到这一点,我将非常有责任... TIA,rixter
<!doctype html>
<html>
<head>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script>
<script src="./development-bundle/ui/jquery.ui.core.js"></script>
<script src="./development-bundle/ui/jquery.effects.pulsate.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a").click(function(event){
//alert("Thanks for visiting!");
});
});
function runEffect() {
$("pulsate").effect( selectedEffect, options, 500, callback );
}
// bind button to click event
$( "#button" ).click(function() {
alert("Running effect...");
runEffect();
return false;
});
// callback function to bring a hidden box back
function callback() {
setTimeout(function() {
$( "#effect" ).removeAttr( "style" ).hide().fadeIn();
}, 1000 );
};
</script>
</head>
<body>
<a href="http://jquery.com/">jQuery</a> …Run Code Online (Sandbox Code Playgroud) 我没有看到此代码在哪里创建此NoMethodFound错误,并且非常想要任何有用的建议.
这是错误消息:
NoMethodError in UploadsController#create
Run Code Online (Sandbox Code Playgroud)
我的模型的相关部分如下所示:
named_scope :by_name, lambda { |marker_name|
{:conditions => ["marker_name = ?", marker_name]}}
def self.parse_file(file)
FasterCSV.foreach(file.path,:headers=>"first_row", :col_sep=>"\t") do |row|
if $header_row == 1
$markers = {} # define global hash for marker id lookup
$markers_arry = [] # define global array for marker names
get_markers(row)
$header_row = 0
# done with header row; loop back to beginning for first row of actual data
next
end
...
def self.get_markers(row)
offset = 8 # this was determine by …Run Code Online (Sandbox Code Playgroud) 我很困惑为什么Postgresql位置函数给出了一个看似简单的测试的不同结果.
这是查询#1:
SELECT count(*)
FROM
dnasample D, ibg_studies ST, subjects S
WHERE
D.studyindex=ST.studyindex
AND ST.studyabrv='CONGER'
AND D.subjectidkey=S.id
AND D.projectindex IS NULL
AND POSITION('Previous subjectid:' in D.comment) IS NULL
Run Code Online (Sandbox Code Playgroud)
返回结果246.
那么这里是查询#2:
SELECT count(*)
FROM
dnasample D, ibg_studies ST, subjects S
WHERE
D.studyindex=ST.studyindex
AND ST.studyabrv='CONGER'
AND D.subjectidkey=S.id
AND D.projectindex IS NULL
AND POSITION('Previous subjectid:' in D.comment)=0
Run Code Online (Sandbox Code Playgroud)
我不明白为什么这些会带来如此不同的结果?
我已经尝试阅读Postgres文档来澄清零和空字符串之间的区别,但还没有太多运气......
提前谢谢, - 里克
这是我想知道的那些日子之一:我是否会失去理智?如果我单步执行这个简单的javascript函数,执行将从第3行跳到第7行.
function editStudy() {
var studyindex = document.StudyMaint.StudyList.selectedIndex;
var studyabrv = document.StudyMaint.StudyList[index].text; //Line 3
var msg="Edit study "+studyabrv+"?";
// Get the Study record id was selected in the picklist,
// then go to Study edit screen, then
if (confirm(msg)) {
location.href="editStudy.php?action=UPDATE&studyindex="+studyindex+"&studyabrv="+studyabrv;
} //Line 7
}
Run Code Online (Sandbox Code Playgroud)
但是我的表格StudyMaint被定义为:
<body>
<?php showUserLine(); ?>
<form name="StudyMaint" action="Process_StudyMaint.php" method="POST" onsubmit="return false">
<div id="dataentrybox">
<div id="innerbox">
<div align="center">
...
Run Code Online (Sandbox Code Playgroud)
有人看到我在这里做错了吗?
我正在尝试编写一个rake任务,用于将CSV文件导入多个模型.代码编译没有错误,但是当我尝试运行它时,我收到此错误消息:
耙子流产了!NameError:'中未定义的局部变量或方法
csv' for main:Object /Users/rickcasey/Projects/Programming/wfrails/lib/tasks/import_partial.rake:28:in块'
这是脚本:
desc "Imports the CSV file "
task :import_partial => :environment do
require 'csv'
csv.foreach('public/partial.csv', :headers => true) do |row|
# create records in independent tables
# create the Company object
this_company_name = row.to_hash.slice(*%w[county_name])
if !(Company.exists?(company_name: this_company_name))
Companies.create(row.to_hash.slice(*%w[company_name operator_num]))
end
thecompany = Company.find(this_company_name)
company_id = thecompany.id
# create the County object
this_county_name = row.to_hash.slice(*%w[county])
if !(County.exists?(county_name: this_county_name))
Counties.create(county_name: this_county_name)
end
thecounty = County.find(this_county_name)
county_id = thecounty.id
# create the GasType object
this_gastype_name = …Run Code Online (Sandbox Code Playgroud)