Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8339531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:54:30+00:00 2026-06-09T04:54:30+00:00

in my application I want set textfield value dynamically coming from header. Here is

  • 0

in my application I want set textfield value dynamically coming from header. Here is the code

in android project I set on header latitude ang longitude and I am trying get this on rails view.

public static String getAddress(final String dir_atoken, final String data_atoken, final float lat, final float lng) throws Exception {

        final HttpGet get = new HttpGet("http://192.168.1.4:3000/address/lookup");

        get.setHeader(LAT,String.valueOf(lat));
        get.setHeader(LNG,String.valueOf(lng));


        return getResponse(get, 200, true);
    }

this is my lookup_address controller

def lookup_address
    @lat = request.headers['Lat']
    @lng = request.headers['Lng']
  end

this is my lookup_address.html.erb

<% form_for @location do |f| %>
    <%=  f.error_messages %>

    <p>
        <%= f.label :latitude %><br />
        <%= f.text_field :latitude, :value => request.headers['Lat'] %>
    </p>
    <p>
        <%= f.label :longitude %><br />
        <%= f.text_field :longitude, :value => request.headers['Lng'] %>
    </p>
    <p>
        <%= f.submit 'Create' %>
    </p>
<% end %>

When I set :value =>request.headers['Lat'] it always return null.

What should I do here for not getting null value?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:54:31+00:00Added an answer on June 9, 2026 at 4:54 am

    Where the @location is built? Guess it will be more correct to set @location.latitude and @location.longitude in controller.

    def lookup_address
      @location = Location.new #Not sure how you build the @location
      @location.latitude = request.headers['Lat']
      @location.longitude = request.headers['Lng']
    end
    

    lookup_address.html.erb

    <% form_for @location do |f| %>
        <%=  f.error_messages %>
    
        <p>
            <%= f.label :latitude %><br />
            <%= f.text_field :latitude %>
        </p>
        <p>
            <%= f.label :longitude %><br />
            <%= f.text_field :longitude %>
        </p>
        <p>
            <%= f.submit 'Create' %>
        </p>
    <% end %>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In My Android Camera Application i want to Set some Effect on the Android
I am working on an MVC2 application and want to set the maxlength attributes
I want to set my server to automatically build my application upon commit on
I have developed the application in which i want to set the background color
In my web application we have many users.I want to set permission for each
I am working on Alarm application in which I want to set Large Sound
I am having one Gtk+ and C application in which i want to set
I've just created a new view based application, and now I want to set
I want to allow users of my application to add sub-users and set privileges
I want to convert a string '30/12/2012' to '2012/12/30'. My application is set to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.