问题描述
我在rhomobile中创建了一个简单的项目.我的主屏幕上显示一个文本框和一个按钮.
I have created a simple project in rhomobile.My home screen shows a text box and a button.
这是index.erb
<div data-role="content">
<br /><br />
Email Address : <input type="text" name="Email" /><br />
<form method="POST" action="<%= url_for(:action =>:show_VibLoc) %>">
<input type="submit" value="Submit" />
</form>
现在,我在app文件夹下的settings文件夹中创建了一个新文件VibLoc.erb
.
Now I have created a new file VibLoc.erb
in settings folder which is under app folder.
在VibLoc.erb
中,我仅显示两个按钮.
in VibLoc.erb
i am showing just two buttons.
在设置文件夹下的controller.rb
文件中,我创建了一个功能show_VibLoc
In the controller.rb
file under settings folder i have created a function show_VibLoc
in此函数将呈现VibLoc.erb
文件
in This function it renders the VibLoc.erb
file
下面是代码:
def show_VibLoc
render :action => :VibLoc
end
代码成功编译,但是当我单击该按钮时,看不到我的VibLoc
视图.
The code compiles successfully but when i click on that button i cant see my VibLoc
view.
我在这里做错了什么?
推荐答案
最后,我自己解决了这个问题.
Finally i resolved it by my self.
而不是在index.erb
<div data-role="content">
<br /><br />
Email Address : <input type="text" name="Email" /><br />
<form method="POST" action="<%= url_for(:action =>:show_VibLoc) %>">
<input type="submit" value="Submit" />
</form>
用这个替换它
<div data-role="content">
<br /><br />
<div data-role="fieldcontain">
Email Address : <input type="text" name="Email" /><br />
</div>
<form method="POST" action="<%= url_for(:controller => :Settings, :action =>:show_VibLoc) %>">
<input type="submit" value="Submit" />
</form>
感谢您看这个问题:)
这篇关于在按钮上显示一个视图,单击rhoMobile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!