Page 1 of 1

button type in the input field

PostPosted: Wed Jun 23, 2010 12:16 am
by kevinwen
Hi, Steve

How do I create a button within a form in the fields.ini, so the following html code shows in the edit form?
Code: Select all
<input type="button" value="Click me" onclick="msg()" />

Re: button type in the input field

PostPosted: Wed Jun 23, 2010 9:21 am
by shannah
You would need to use a block or slot and place the button somewhere in the form.

-Steve

Re: button type in the input field

PostPosted: Wed Jun 23, 2010 1:23 pm
by kevinwen
I know I can use one of blocks(block__findform_after_person_id_row, block__findform_xxx_widget, findform_after__widget, etc.) available to output the html code for the button , but I couldn't find a ideal block for that because layout looks ugly. Currently I have a block defined in fields.ini looks like this in html code:

Code: Select all
<tr id="person_id_findform_row">
      <td align="right" valign="top" class="Dataface_QuickForm-label-cell Dataface_FindForm-label-cell">
      <div id="findform_people-person_id-label-wrapper" class="field">
         <label>Locator#</label>
      </div>
      </td>
      <td class="Dataface_QuickForm-widget-cell Dataface_FindForm-widget-cell">
      <div id="people-person_id-wrapper" class="field">
         <div>
            <input type="text" value="2728" name="-findq:person_id" id="person_id" class="default">
         </div>
         <div class="formHelp"></div>
      </div>
      </td>
</tr>


What I want to do is add a button as a separate row or the 2nd table cell next to the 'Find' button' in the form, just like the following:
Code: Select all
<tr id="clearform_findform_row">
      <td align="right" valign="top" class="Dataface_QuickForm-label-cell Dataface_FindForm-label-cell">
      <div id="findform_people-clearform-label-wrapper" class="field">
         <label>Clear all</label>
      </div>
      </td>
      <td class="Dataface_QuickForm-widget-cell Dataface_FindForm-widget-cell">
      <div id="people-clearform-wrapper" class="field">
         <div>
            <input type="button" value="Clear Form" name="-findq:clearform" id="clearform" class="default" onclick="resetForm(this.form);">
         </div>
         <div class="formHelp"></div>
      </div>
      </td>
</tr>


How can I do that?

Re: button type in the input field

PostPosted: Thu Jun 24, 2010 8:53 am
by shannah
There should be an appropriate slot to place it right beside the submit button.... I don't have the info handy, but if you turn on debug it will list them all out.

Alternatively you can always use javascript to modify any part of the page and add a button wherever you want it.

Re: button type in the input field

PostPosted: Thu Jun 24, 2010 11:37 am
by kevinwen
I found there is a block findform_after__widget around the submit button. However, this block appears after all of the "Do not match selected" radio buttons for multiple-select. Is it possible to check if this findform_after__widget block after a certain element so I decide whether or not to output the html code for the button?