I'm pre-populating a form using data from dynamodb. I'm passing all the content in as part of the render_template statement:
return render_template('edit_ride_input.html',
rideDate=item.get('ride_date'),
rideLocation=item.get('ride_location'),
rideLevel=item.get('ride_level'),
rideCap=item.get('ride_cap'),
rideVis=item.get('ride_vis'),
rideRange=item.get('ride_range'),
rideReg=item.get('ride_reg'),
rideFuel=item.get('ride_fuel'),
rideLunch=item.get('ride_lunch'),
rideMeetLocation=item.get('ride_meet_location'),
rideMeetTime=item.get('ride_meet_time'),
rideUnloadTime=item.get('ride_unload_time'),
rideUnloadLocation=item.get('ride_unload_location'),
rideDescription=item.get('ride_description'))
I then use the value= attribute on each of the form elements to pre-populate the data:
<div class="form-group ">
<label class="col-md-4 control-label" for="ride_date">*Date:</label>
<div class="col-md-4">
<input id="ride_date" name="ride_date" value={{rideDate}} type="text" placeholder="DD/MM/YYYY" class="form-control" required="" />
</div>
</div>
<!-- Text input-->
<div class="form-group">
<label class="col-md-4 control-label" for="ride_location">*Location:</label>
<div class="col-md-4">
<h1>{{rideLocation}}
<input id="ride_location" name="ride_location" value= {{rideLocation}} type="text" placeholder="Where is the ride being held?" class="form-control input-md" required="">
</div>
The problem is, when the form is rendered, it only shows the data from the variables up to the first whitespace. For example, if I pass in rideLocation with a value of "Nightcap National Park" all that will appear in the input field is "Nightcap". I know the variable contains the full string, because when I render it directly in the page as {{rideLocation}} I see "Nightcap National Park"
Am I doing something wrong?