Mahmud Adam Mahmud Adam - 1 year ago 80
HTML Question

Input hidden value propery when value has spaces

I have a form with the hidden value holding onto the name of a question that is stored in a mysql database. The issue I am having is that the hidden value only holds onto the first part of the name. For example, in my template:

% for d in data
<input type="hidden" name="question_name" value={{d["name"]}}>
% end

would be something like "math question". When I checked the
value on the server, and the hidden input value in jQuery, the result is
and it leaves out anything coming after the first word. What could be causing this?

Answer Source

You need to wrap it with quotes other ways the remaining part is considered as another attribute of the tag.

% for d in data
  <input type="hidden" name="question_name" value="{{d["name"]}}">
% end
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download