Search code examples
rubyrhomobilerhodes

Showing a View on a button click in rhoMobile


I have created a simple project in rhomobile. My home screen shows a text box and a button.

here is the code for that in 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>

Now I have created a new file VibLoc.erb in settings folder which is under app folder.

in VibLoc.erb i am showing just two buttons.

In the controller.rb file under settings folder i have created a function show_VibLoc

in This function it renders the VibLoc.erb file

here is the code:

def show_VibLoc
render :action => :VibLoc
end

The code compiles successfully but when i click on that button i cant see my VibLoc view.

what i am doing wrong here??


Solution

  • Finally i resolved it by my self.

    Instead of writing this code in 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>
    

    replace it with this one

    <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>
    

    Thanks for looking at this question :)