Advertisement:

Author Topic: Car attribute forms not getting submitted after repositioning  (Read 1084 times)

goodisme

  • Newbie
  • *
  • Posts: 24
Hi Guys,

this is my first post here and i must say that i feel honored to be a part of this forum.(enough with the pleasantries..lol)

i recently installed the plugin and i already had a long enough search form on my side bar so i decided to move it to the central column.

this is what i did:

1) i started by changing the hook name "search_form.php" to "search_disp.php" in the car attribute plugin since it shares the same hook with custom attributes.
2) i then pasted the 'new' hook inside the central column after which the car attribute plugin appeared in the central panel
3) i then wrapped the car attribute hook inside a <form>.
4) then i added a submit button and used jquerry to make the button submit the car attribute forms and the main search forms together.

now the problem is that when i click on the car attribute's submit button, the search page refreshes without providing the search results but it works only when the car attribute form is at its original position. but i need it at the new position for accessibility reasons.

See images for further explanation

goodisme

  • Newbie
  • *
  • Posts: 24
Re: Car attribute forms not getting submitted after repositioning
« Reply #1 on: June 10, 2017, 11:27:31 pm »
Guys, this is how the hook looks on my search.php file:
Code: [Select]
<div class="abc search list-group-item" style="background:transparent; margin-top:0;">
                                            <form action="<?php echo osc_base_url(true); ?>" method="get" class="nocsrf" id="secondform">
                                                <input type="hidden" name="page" value="search" />
                                                <input type="hidden" name="sOrder" value="<?php echo osc_esc_html(osc_search_order()); ?>" />
                                                <input type="hidden" name="sCompany" class="sCompany" id="sCompany" value="<?php echo Params::getParam('sCompany');?>" />
                                                <input type="hidden" name="iOrderType" value="<?php $allowedTypesForSorting Search::getAllowedTypesForSorting(); echo osc_esc_html($allowedTypesForSorting[osc_search_order_type()]); ?>" />
                                                <?php foreach(osc_search_user() as $userId) { ?>
                                                <input type="hidden" name="sUser[]" value="<?php echo osc_esc_html($userId); ?>" />
                                                <?php ?>
                                               
    <fieldset style="border:none;padding:5px 0px 0px 0px;background:transparent" class="box location">
<div class="form-group">
<?php if(osc_search_category_id()) { osc_run_hook'search_disp'osc_search_category_id()); } else { osc_run_hook'search_disp'); } ?></div>
</fieldset>
</form>

and this is the modification on the car attribute search form with the created button:
Code: [Select]
<form action="<?php echo osc_base_url(true); ?>" method="get" class="nocsrf" id="secondform">
<input type="hidden" name="page" value="search" />
                                                <input type="hidden" name="sOrder" value="<?php echo osc_esc_html(osc_search_order()); ?>" />
                                                <input type="hidden" name="sCompany" class="sCompany" id="sCompany" value="<?php echo Params::getParam('sCompany');?>" />
                                                <input type="hidden" name="iOrderType" value="<?php $allowedTypesForSorting Search::getAllowedTypesForSorting(); echo osc_esc_html($allowedTypesForSorting[osc_search_order_type()]); ?>" />
                                                <?php foreach(osc_search_user() as $userId) { ?>
                                                <input type="hidden" name="sUser[]" value="<?php echo osc_esc_html($userId); ?>" />
                                                <?php ?>
<fieldset">
    <h3><?php _e('Cars attributes''cars_attributes') ; ?></h3>
    <div class="row one_input">
        <h6><?php _e('Make''cars_attributes'); ?></h6>
        <select name="make" id="make" >
            <option value=""><?php  _e('Select a make''cars_attributes'); ?></option>
            <?php foreach($makes as $m) { ?>
                <option value="<?php echo $m['pk_i_id']; ?>" <?php if($make == $m['pk_i_id']) { echo 'selected'; } ?>><?php echo $m['s_name']; ?></option>
            <?php ?>
        </select>
    </div>
    <div class="row one_input">
        <h6><?php _e('Model''cars_attributes'); ?></h6>
        <select name="model" id="model">
            <option value=""><?php _e('Select a model''cars_attributes'); ?></option>
            <?php foreach($models as $m) { ?>
                <option value="<?php echo $m['pk_i_id']; ?>" <?php if($model == $m['pk_i_id']) { echo 'selected';} ?>><?php echo $m['s_name']; ?></option>
            <?php ?>
        </select>
    </div>
    <div class="row one_input">
        <h6><?php _e('Car type''cars_attributes'); ?></h6>
        <select name="type" id="type">
            <option value=""><?php _e('Select a car type''cars_attributes'); ?></option>
            <?php foreach($types as $p) { ?>
                <option value="<?php echo $p['pk_i_id']; ?>" <?php if($type==$p['pk_i_id']) { echo 'selected'; } ?>><?php echo $p['s_name']; ?></option>
            <?php ?>
        </select>
    </div>
    <div class="row one_input">
        <?php $transmission Params::getParam('transmission') ; ?>
        <h6 for="transmission"><?php _e('Transmission''cars_attributes'); ?></h6>
        <input style="width:20px;" type="radio" name="transmission" value="MANUAL" id="manual" <?php if($transmission == 'MANUAL') { echo 'checked="yes"'; } ?>/> <label for="manual"><?php _e('Manual''cars_attributes'); ?></label><br />
        <input style="width:20px;" type="radio" name="transmission" value="AUTO" id="auto" <?php if($transmission == 'AUTO') { echo 'checked="yes"'; } ?>/> <label for="auto"><?php _e('Automatic''cars_attributes'); ?></label>
    </div>
<button style="width:100%;margin-top:5px;" class="btn btn-success" id="subbut()">
                                                        <?php _e("Update results"'sahara'); ?>
                                                    </button>
</fieldset>
</form>