在按钮上显示一个视图,单击rhoMobile [英] Showing a View on a button click in rhoMobile

查看:84
本文介绍了在按钮上显示一个视图,单击rhoMobile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆