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 7645109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:51:23+00:00 2026-05-31T09:51:23+00:00

I have been stressing about this for a few hours and I cannot get

  • 0

I have been stressing about this for a few hours and I cannot get it working. I have no experience in javascript and have been searching around in the forum and other sites, but I can’t seem to get a solution that works.

I am trying to fill in the form using a webView in xCode

The website http://www.eatwellguide.org/mobile/ is where the form is located.

The website has this forum

             <form name="data[Search][form]" METHOD="post" ACTION="/search/advanced/find" ID="frmAS" >
                 <ul>
                   <li><input type="hidden" name="device" id="device" value="mobile" title="mobile">
                      <input type="hidden" name="iframe" id="iframe" value="11" title="mobile" > Keyword: </li>
                   <li><input type="text" name="data[Search][keyword]" id="SearchKeyword" title="search by keywords" /> 
                      <input ID="SearchSubmit" class="BTNsend"  type="submit" value="Find" name="data[Search][submit]"/></li>
                   <li>Zip / Postal  Code:</li>
                   <li><input type="text" title="Zip search" value="" name="data[Search][zip_code]"  />   <input ID="SearchSubmit" class="BTNsend" type="submit" value="Find" name="data[Search][submit]"/> </li>
                   <li><select name="data[Search][distance]" style="font-size:120%; ">
                         <option value="1">1</option>
                         <option value="5"  selected="">5</option>
                         <option value="10">10</option>
                         <optionvalue="20">20</option>
                         <option value="50">50</option>
                         <option value="100">100</option>
                         <option value="200">200</option>
                        </select> <input type="radio" ID="SearchDistanceUnit" value="Mi" checked="" name="data[Search][distance_unit]" class="BTNradio"/> Mi

I am trying to modify the textbox that i has the title = “zip search” and submit the form, but my code doesn’t work at all. It won’t even fill in the textbox

    NSString* javaScriptString = @"document.getElementById('data[Search][zip_code]').elements.value='22911';";



[self.webView stringByEvaluatingJavaScriptFromString: javaScriptString];

It just does nothing. I have also tried GetElementsByName and many other variations of the two.

  • 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-05-31T09:51:24+00:00Added an answer on May 31, 2026 at 9:51 am

    Browsers support the input of JavaScript directly into the URL bar. So if you load the page you link to, then enter the following URL:

    javascript:alert(document.getElementsByName('data[Search][zip_code]'))
    

    You’ll get an alert message showing what was found. In that case I’ve taken your getElementByName and corrected it — elements should be plural and it returns an array.

    Building up:

    javascript:alert(document.getElementsByName('data[Search][zip_code]')[0])
    

    Evaluates to show an input element. Then:

    javascript:alert(document.getElementsByName('data[Search][zip_code]')[0].value)
    

    Shows the current value, and:

    javascript:document.getElementsByName('data[Search][zip_code]')[0].value = '22911'
    

    Populates the box. So that’s the string you want (minus the javascript:).

    If you’d taken a syntactic wrong turn, at least in Mobile Safari, your statement would be ignored. If you’d ended up trying to fetch something that isn’t there you’d have received a NULL message in an alert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have been struggling with Javascript closure for a while trying to wrap brain around
I have been working on a web services related project for about the last
Ok, I have been trying to wrap my head around this http live streaming.
I've been reading about reliable messaging and have a few questions that I haven't
I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have been searching everywhere for the following functionality in Lisp, and have gotten
I have been using PHP and JavaScript for building my dad's website. He wants
I have been struggling with this for a while and could really use some
My web services have been working perfectly, It's hard to tell what I did
I am a little OCD and this is driving me insane. I have been

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.