Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
889 views
in Q2A Core by
I have a input and a select in the form and I wanna put a button right after each.

Currently if I add buttons to fields they just appear below input and select on the third raw, how can I display them like I said above?
Q2A version: 1.6.3

1 Answer

+1 vote
by
selected by
 
Best answer

Q2A form items are displayed with table tag basically. When you display plural elements in one row, you can use "custom" type field.

Script example: qa-include/qa-page-admin-default.php

Search with 'type' => 'custom'

by
Thank you for your reply.
I have checked that page out and I can modify it to my page but I still can not change it to what I want.

Basically I want a form with every raw like this:
<tr><td><input/><button/><button/></td></tr>
So I tried this:

$listhtml = '<table class="qa-form-wide-table"><tbody>';
     foreach ($skills as $index => $skillword) {
     // inputs
     $listhtml.='<tr><td class="qa-form-wide-data">
     <input id="input_'.$index.'" name="input_'.$index.'" class="qa-form-wide-text" type="text" value = '.qa_html($skillword).'></input></td></tr>';
     // buttons
     .....
     $listhtml.='</tbody></table>';
}

$qa_content['form_1']=array(
     'tags' => 'method="post" action="'.qa_self_html().'" name="edit_skills_form"',
     'title' => 'Edit Skills: ',
     'type' => 'custom',
     'html' => $listhtml,
);

But I cannot get any output on my page.
Only output is <form>...</form>.
I guess this is not the right way to use "type => 'custom'".
Could you please help me figure out how to make it work?
Thank you so much !
by
$qa_content['form']['fields']['my-multi-field'] => array(
  'label' => 'My multi field:',
  'style' => 'wide',  // wide:label is displayed in side. tall: label is displayed in top.
  'type' => 'custom',
  'html' => '<input/><button>aaa</button>',
);
by
I finally figured this out yesterday.
Now I had another problem which was about qa_clicked() and refreshing the page. Could you please take a look at the question that I have posted below?
http://www.question2answer.org/qa/32169/how-to-clear-or-disable-qa_clicked-when-refreshing-the-page
Thank you so much
...