Announcement Announcement Module
Collapse
No announcement yet.
unexpected behaviour of spring.ftl macro 'formInput' Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • unexpected behaviour of spring.ftl macro 'formInput'

    Hi there,

    I'm using Freemarker as the view in my current project and the macros defined in spring.ftl to write out my input fields, buttons etc.
    The problem I'm encountering at the moment is that some (not all!) of my plain input type="text" fields are prepopulated with values, although the objects behind these fields have just been created and not been initialised yet.
    This is an extract of one of my ftl templates:
    Code:
    <p>
            <label>Postcode</label>
            <@spring.formInput path="form.part01.you.currentAddress.postcode" />
            <@spring.showErrors separator="<br>" classOrStyle="error" />
          </p>
    	  
          <p><span class="descriptionText">Do not tell us your partner's address if it is the same as yours.</span></p>
          
          <label id="widerQuestions">What date did you move to this address:</label><br />
            <br />
            <@spring.formInput path="form.part01.you.moveInDate.day" fieldType="text" attributes="maxlength=\"2\"" />
            <@spring.showErrors separator="<br>" classOrStyle="error" />
            <@dropdown.dd_months path="form.part01.you.moveInDate.month" />
            <@spring.showErrors separator="<br>" classOrStyle="error" />
    	<@spring.formInput path="form.part01.you.moveInDate.year" fieldType="text" />
    	<@spring.showErrors separator="<br>" classOrStyle="error" />
     
    	 <p>
    ... and this the generated html:
    Code:
    <p>
            <label>Postcode</label>
        <input type="text" id="part01.you.currentAddress.postcode" name="part01.you.currentAddress.postcode" value="" 
        >
          </p>
    	  
          <p><span class="descriptionText">Do not tell us your partner's address if it is the same as yours.</span></p>
          <label id="widerQuestions">What date did you move to this address:</label><br />
            <br />
        <input type="text" id="part01.you.moveInDate.day" name="part01.you.moveInDate.day" value="4" maxlength="2"
        >
    <select name="part01.you.moveInDate.month" id="part01.you.moveInDate.month">
    	<option value="1">January</option>
    	<option value="2">February</option>
    	<option value="3">March</option>
    	<option value="4">April</option>
    	<option value="5">May</option>
    	<option value="6">June</option>
    	<option value="7">July</option>
    	<option value="8">August</option>
    	<option value="9">September</option>
    	<option value="10">October</option>
    	<option value="11">November</option>
    	<option value="12">December</option>
    </select>
        <input type="text" id="part01.you.moveInDate.year" name="part01.you.moveInDate.year" value="106" 
        >
    	 <p>
    Does somebody have an idea why the day and year fields are already filled, but the postcode field isn't? Any ideas / hints / comments appreciated as I'm sitting in front of it like a sheep...

    Jessica

  • #2
    ...*beadle* ...

    "Unfortunately" I didn't import my own object Date but the java.util one...

    Never mind

    Comment

    Working...
    X