Jump to:

2011 Posts in 1436 Topics by 620 members

Form Questions

SilverStripe Forums » Form Questions » Customise html output of form

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1762 Views
  • gethyn1
    Avatar
    Community Member
    1 Post

    Customise html output of form Link to this post

    I currently have a contact form displaying the following mark up:

    <form>
    <fieldset>
    <legend></legend>

    <div id="Name" class="field text ">
    <label class="left" for="Form_ContactForm_Name">Name*</label>
    <div class="middleColumn">
    <input type="text" class="text" id="Form_ContactForm_Name" name="Name" value="" />
    </div>
    </div>

    <div id="Email" class="field email ">
    <label class="left" for="Form_ContactForm_Email">Email*</label>
    <div class="middleColumn">
    <input type="text" class="text" id="Form_ContactForm_Email" name="Email" value="" />
    </div>
    </div>
          
    <div id="Comments" class="field textarea ">
    <label class="left" for="Form_ContactForm_Comments">Comments*</label>
    <div class="middleColumn">
    <textarea id="Form_ContactForm_Comments" name="Comments" rows="5" cols="20"></textarea>
    </div>
    </div>

    <input class="hidden" type="hidden" id="Form_ContactForm_SecurityID" name="SecurityID" value="760995074" />
    </fieldset>
    <input class="action" id="Form_ContactForm_action_SendContactForm" type="submit" name="action_SendContactForm" value="Send" title="Send" />
    </form>

    I would like to strip out the unnecessary divs and classes so that the markup looks more like this:

    <form>
    <fieldset>
    <legend></legend>

    <label for="Form_ContactForm_Name">Name*</label>
    <input type="text" id="Form_ContactForm_Name" name="Name" value="" />

    <label for="Form_ContactForm_Email">Email*</label>
    <input type="text" id="Form_ContactForm_Email" name="Email" value="" />
          
    <label for="Form_ContactForm_Comments">Comments*</label>
    <textarea id="Form_ContactForm_Comments" rows="5" cols="20"></textarea>

    <input class="hidden" type="hidden" id="Form_ContactForm_SecurityID" name="SecurityID" value="760995074" />
    </fieldset>
    <input class="action" id="Form_ContactForm_action_SendContactForm" type="submit" name="action_SendContactForm" value="Send" title="Send" />
    </form>

    I managed to edit some of the html output in sapphire/templates/includes/Form.ss but can't locate where the rest of the mark up is being defined.

    Any help would be appreciated, thanks..

  • Ingo
    Avatar
    Forum Moderator
    801 Posts
    1762 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.