Advertisement:

Author Topic: Cancel button in item-post.php  (Read 1938 times)

tabuausada

  • Jr. Member
  • **
  • Posts: 77
Cancel button in item-post.php
« on: March 21, 2016, 07:59:34 pm »
Need some help to create a button right next to publish button to cancel the creation of a new ad. By clicking the cancel button the user woould be redirected to the account homepage. Did anyone added this functionality to bender theme? Could you share the required code? Thanks in advance! :)

tabuausada

  • Jr. Member
  • **
  • Posts: 77
Re: Cancel button in item-post.php
« Reply #1 on: April 26, 2016, 05:57:14 pm »
Can someone help please? Seems to be a simple feature to increase usability of bender...

osCanyon

  • Hero Member
  • *****
  • Posts: 701
  • osCanyon, the class of Osclass
Re: Cancel button in item-post.php
« Reply #2 on: April 29, 2016, 06:03:16 am »
you mean "after" the ad was listed? or just before?
if before and you dont 'Publish', there is nothing to do, just browse to another page  :)

tabuausada

  • Jr. Member
  • **
  • Posts: 77
Re: Cancel button in item-post.php
« Reply #3 on: May 02, 2016, 01:16:12 pm »
Just before. Instead of deciding to hit publish the user might decide to cancel cleaning the form and going back to is account page instead of using the browser buttons. I think this would provide a cleaner and more "professional" way to "walk around" the site. In my opinion one of the less developed areas of bender is the user interface (a bit messy and non responsive in some cases...) with my very basic knowledge of programming languages I've been trying to improve things...

osCanyon

  • Hero Member
  • *****
  • Posts: 701
  • osCanyon, the class of Osclass
Re: Cancel button in item-post.php
« Reply #4 on: May 02, 2016, 02:25:59 pm »
would be  cool 'extra' feature to have :)
using some of the same code to create the 'Publish' button and adding something as seen here may work, I will play a little today and see what happens

<input type="button" value="Reset Form" onClick="this.form.reset()" />
Using an HTML ‘Reset’ button is an easy way to reset all form fields to their default values. For instance, the code snippet below shows an <input> field of type “reset”, which on being clicked resets all the form fields:

<input type="reset" value="Reset Form">

In fact, we could also use the form’s reset() method to achieve the same effect, using a simple button element:

<input type="button" value="Reset Form" onClick="this.form.reset()" />


and a site with some js tricks :)
http://www.javascript-coder.com/javascript-form/javascript-reset-form.phtml


ADDED INFO
I added a bit of code to the item-post.php and its works, may have to play around with styling a bit
towards bottom, find <button type="submit" class="ui-button ui-button-middle ui-button-main">
and add as I did (see pic)
Code: [Select]
<div class="controls">
                                <button type="submit" class="ui-button ui-button-middle ui-button-main"><?php if($edit) { _e("Update"'canyon_lemon_lime'); } else { _e("Publish"'canyon_lemon_lime'); } ?></button>
<input type="button" class="ui-button ui-button-middle ui-button-main" value="Reset Form" onClick="this.form.reset()" />
                            </div>

« Last Edit: May 02, 2016, 03:09:10 pm by DigitalConcepts »

osCanyon

  • Hero Member
  • *****
  • Posts: 701
  • osCanyon, the class of Osclass
Re: Cancel button in item-post.php
« Reply #5 on: May 02, 2016, 04:08:39 pm »
just to keep it more clear ( and I decided to keep as well)

replace with
Code: [Select]
<div class="controls">
                                <button type="submit" class="ui-button ui-button-middle ui-button-main"><?php if($edit) { _e("Update"'canyon_lemon_lime'); } else { _e("Publish"'canyon_lemon_lime'); } ?></button>
<input type="button" style="width: 120px; height: 38px" class=" ui-button-main" value="Cancel" onClick="this.form.reset()" />
                            </div>

osCanyon

  • Hero Member
  • *****
  • Posts: 701
  • osCanyon, the class of Osclass
Re: Cancel button in item-post.php
« Reply #6 on: May 02, 2016, 07:20:14 pm »
sorry for Not reading your post and supply what you ask for :(

so here are two ways,
1st- button to clear form of all text
2nd -button to return to home page
either keep both or remove the line (button) you Dont want :)

picture is with both buttons active

about line 195 on item-post.php
the fist line is original code from bender for the publish button
the second line is the button to clear the form
the third line is the button to return to home page
the words Cancel and Home can be whatever you want to name them.
Code: [Select]
<div class="controls">
                                <button type="submit" class="ui-button ui-button-middle ui-button-main"><?php if($edit) { _e("Update"'canyon_lemon_lime'); } else { _e("Publish"'canyon_lemon_lime'); } ?></button>
<input type="button" style="width: 120px; height: 38px" class=" ui-button-main" value="Cancel" onClick="this.form.reset()" />
<input type=button onClick="parent.location='<?php echo osc_base_url(true);?>'" style="width: 120px; height: 38px" class=" ui-button-main" value='Home'>
                            </div>