0

Trying to pass the value entered in a textbox by a user as the id of the form. Code snippet below. This always passes params.id = "index" in my controller. If i hardcode form id="someText" it passes params.id = "someText" to controller. Due to certain constraints i have to use button element instead of g:actionsubmit.

<g:form controller="search" action="index" id=${searchText} method="post">
    <div>
        <g:textField name="searchText"></g:textField>       
         <button type="submit" class="btn">
            <i class="icon-search"></i>
         </button>
    </div>
</g:form>

Any solutions?

IKavanagh
  • 6,089
  • 11
  • 42
  • 47
Da_Vicki
  • 91
  • 1
  • 8

1 Answers1

0
<g:form controller="search" action="index" method="post">
    <div>
        <g:textField name="id"></g:textField>       
        <button type="submit" class="btn">
            <i class="icon-search"></i>
        </button>
    </div>
</g:form>
Dopele
  • 547
  • 3
  • 16
  • I had tried this before posting the question. params.id = 'index' is passed when name of textfied is 'id' – Da_Vicki Apr 04 '13 at 17:32