Jump to content



Latest News: (loading..)

- - - - -

checkboxField problem


  • Please log in to reply
5 replies to this topic

#1   Foayiid

Foayiid
  • Members
  • 50 posts
  • Real Name:fred
  • Gender:Male

Posted 13 March 2012 - 07:48 PM

The checkboxes in the Admin are defined with true / false parameter in the applications but the HTML::chekboxField function needs a true / null parameter.

I give an exemple, file Core/Site/Admin/Application/Customers/page/scetion_personnal.php
<p><label for="status"><?php echo OSCOM::getDef('field_status'); ?></label><?php echo HTML::checkboxField('status', null, ($new_customer ? true : ($OSCOM_ObjectInfo->get('customers_status') == '1'))); ?></p>

with this code when the 'customers_status' = 0 the customer line is red in the main table but when you clic to edit the status checkbox is still 'on'.

I think this code should be better :
<p><label for="status"><?php echo OSCOM::getDef('field_status'); ?></label><?php echo HTML::checkboxField('status', null, ($new_customer ? true : ($OSCOM_ObjectInfo->get('customers_status') == '1' ? true : null))); ?></p>

Am I true ?

Edited by Foayiid, 13 March 2012 - 07:48 PM.


#2   foxp2

foxp2

    strong as a Twig

  • Members
  • 303 posts
  • Real Name:Laurent
  • Gender:Male
  • Location:France

Posted 13 March 2012 - 08:20 PM

Hi Fred,
or change null by on :
	  <p><label for="status"><?php echo OSCOM::getDef('field_status'); ?></label><?php echo HTML::checkboxField('status', 'on', ($new_customer ? true : ($OSCOM_ObjectInfo->get('customers_status') == '1'))); ?></p>
?
-------------------

#3   Foayiid

Foayiid
  • Members
  • 50 posts
  • Real Name:fred
  • Gender:Male

Posted 13 March 2012 - 08:56 PM

Yes we can !!! (it's not a slogan) >_<  or maybe a '1'

Now we can change this files :
Core / Site / Admin / Application / Customers / pages / section_personal.php
Core / Site / Admin / Application / Customers / pages / section_newsletters.php

and perhaps others ... i will report if I find

#4   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 3,952 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 14 March 2012 - 09:22 AM

Hi Fred..

Great catch!

How does this look:

https://github.com/haraldpdl/oscommerce/commit/cced2a7831bd864ec583ca3e19024bb2cffb18ea

Kind regards,
Harald Ponce de Leon

#5   Foayiid

Foayiid
  • Members
  • 50 posts
  • Real Name:fred
  • Gender:Male

Posted 15 March 2012 - 04:16 PM

Well done Harald !

I see another (small) problem ...
in the Core/Site/Admin/Application/Customers/page/section_addressBook.php the following funtions showNewAddressForm() and showEditAddressForm()  contain this code :
function showEditAddressForm(id) {
  $('#sectionMenuContainer').animate({'opacity': '0.30'}, 'fast').children().attr('disabled', true);
  $('#formButtons').animate({'opacity': '0.30'}, 'fast').children().attr('disabled', true);

But Firefox, Chrome, ... and other browsers disable DOM events on form fields.
So the buttons are still clickable and the section appears and ... :x

In the admin, the importance is low because someone can, at worst, change a value he is not careful but I wondering if this kind of method is used in the Shop side ???? with evil customers ....

Best regards,

Edited by Foayiid, 15 March 2012 - 04:22 PM.


#6   Harald Ponce de Leon

Harald Ponce de Leon

    Healthy Giraffe

  • Core Team
  • 3,952 posts
  • Real Name:Harald Ponce de Leon
  • Gender:Male
  • Location:Solingen, Germany

Posted 15 March 2012 - 04:41 PM

Hi Fred..

Ah, that's a bug that the Personal, Password, Newsletters, Map, and Social buttons can still be clicked on, however the main form Save and Cancel buttons (on the top right side) do not function when they are disabled so this part works correctly.

Tested on Chrome, Firefox, and Safari.

Kind regards,
Harald Ponce de Leon