Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 75972

HTML form submission cuts off symbols after space in the values

$
0
0

I have a Flask web app where I take entry from a form. It has two lists:

<div class="form-row">
  <div class="form-group col-md-6">
    <label for="selected_domain" class="col-form-label">Select domain where service belongs</label>
    <select id="selected_domain" name="selected_domain" class="form-control">
      <option>Choose</option>
      {%for x in domain%}
      <option value="{{x}}">{{x}}</option>
      {%endfor%}
    </select>
  </div>
  <div class="form-group col-md-6">
    <label for="selected_platform" class="col-form-label">Select platform exposing the service</label>
    <select name="selected_platform" id="selected_platform" class="form-control">
      <option>Choose</option>
      {%for x in platform%}
      <option value={{x}}>{{x}}</option>
      {%endfor%}
    </select>
  </div>
</div>

I am populating the lists via similar python methods (from graph):

def listdomains():
    with driver.session() as session:
        tx=session.begin_transaction()
        statement=("MATCH (d:domain) RETURN d.name ORDER BY d.name")
        statementResult=tx.run(statement).value()
        tx.close()
        session.close()
    return statementResult

def listAllplatforms():
    with driver.session() as session:
        tx=session.begin_transaction()
        statement=("MATCH (p:platform) RETURN p.name ORDER BY p.name")
        statementResult=tx.run(statement).value()
        tx.close()
        session.close()
    return statementResult

In the form I get all values properly displayed. Only after submission, I get problems with the value coming back for the Platforms, it cuts off all symbols after the space, if it has space in the value. Please note that the Domains list returns proper value, despite being defined in same way. So, for values "Example Domain 1" and "Example Platform 1" my variables test in python :

print(platform)
print("Platform is string",isinstance(platform,str))
print(domain)
print("Domain is string",isinstance(domain,str))

returns this:

Console output

What could be the problem?


Viewing all articles
Browse latest Browse all 75972

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>