Setting default to nothing on a scroll down menu

    • 629 posts
    April 1, 2019 7:07 PM EDT
    cmackie said:

    Regarding the subject of Physics, I am currently reading "The Trouble With Physics" which I thoroughly recommend.

     

    I'll definitely check that book out. Lee Smolin wrote it in 2006, on string theory among other subjects.

    I always thought quantum possibility is a void housing infinite realities.

    • Moderator
    • 6923 posts
    April 2, 2019 8:12 AM EDT
    cmackie said:

    Thanks Elshara!  

    You tell me to use radio buttons but this scroll down menu is responsible for the wiring for a lot of the forums in my site.  I cannot disturb what has been built.  I need to find where it is located and fix this issue. 

    You say: A find and replace command using Em Editor would be the fastest way on a computer to make the text appear.

    Where can I find Em Editor?

    You say: your other option is to look in the settings of your custom plugin to see if there's an option to tweak to show default text for the category system

    I do not know which plug in was used for this feature.  See screenshot of my plugins below.

    Thanks!

    In regards to your screenshot and Elshara, he is blind. Would you please post him a list so his screenreader can read it?Thank you.

    • 217 posts
    April 2, 2019 8:02 PM EDT

    Thanks Donna, I will type out the list by hand when I get a moment.  

    • 217 posts
    April 3, 2019 5:02 PM EDT

    I downloaded ultra edit (instead of em editor) because I am on a mac.  It will only open files (not folders) and I don't know what file the text is in.  See Screen Shot 2019-04-03 at 4.56.37 pm.  I assume we are trying to find the question "In which district are you eligible to vote?"  Am I correct?

     

    Plugins (from admin control panel):

    Cecilia custom Work

    Events

    Groups

    SES - Advanced nested comments with attachments

    SES - Advanced News and Activity Feeds

    SES - Basic Required

    SES - Discussions

    SES - Page Building and SHortcodes

    Tom Friend 

    • 303 posts
    April 4, 2019 2:25 PM EDT

    Ok I've managed to achieve this. 

     

    On the profile sign up page, you want to choose selection box  www.yourdomain.com/admin/user/fields

     

     

     

     

    in the settings, you can make this a required question 

     

    https://gyazo.com/9f8b69252149fea7d53a3523af7573c8

     

    and that's it, done. 

     

    on the drop down you can see that the top option is blank, a user cannot leave it blank as its a required field. 


    This post was edited by PeppaPigKilla at April 4, 2019 2:30 PM EDT
    • 217 posts
    April 5, 2019 1:08 PM EDT

     Thanks Peppa!  I can see this is available as a profile field but this question is on the sign up page. 

    To Everyone:

    My developers have finally given me the code they used to place it there.  I hope this will help us to fix the problem! 

     

    Districts: File Path: /public_html/application/modules/User/Form/Signup/Account.php (approx line: 289) $categories = Engine_Api::_()->getDbtable('categories', 'cecustom')->getCategoriesAssoc(); if( count($categories) > 0 ) { $this->addElement('Select', 'category_id', array( 'label' => 'In which district are you eligible to vote?', 'multiOptions' => $categories, )); } For Edit Section here: https://werunthehouse.org/cecustom/edit/district in engine4_users -> (Field Namecategory_id File Path: /public_html/application/modules/Cecustom/Form/Edit/District.php This contains: <?php class Cecustom_Form_Edit_District extends Engine_Form { public function init() { $this->setTitle("Edit District"); //SES Custom Work $categories = Engine_Api::_()->getDbtable('categories', 'cecustom')->getCategoriesAssoc(); if( count($categories) > 0 ) { $this->addElement('Select', 'category_id', array( 'label' => 'In which district are you eligible to vote?', 'multiOptions' => $categories, )); } //SES Custom Work
    • 303 posts
    April 5, 2019 1:11 PM EDT
    That profile field I gave was on the sign up too. None the less. Seems what you’re doing places people into a “ role “ so to speak which a profile field doesn’t.
    • 303 posts
    April 5, 2019 1:27 PM EDT

    looks like its getting the information from the table 'engine4_users' 

     

    this is the data structure of mine 

     

     

    you should be looking for 'catergory_name' , as you can see mine doesnt have that as you have had custom tables added. 

    find that table and let us know whats in it. 

    • 217 posts
    April 5, 2019 1:56 PM EDT

    It is category_id.  I have taken a screenshot below.  It has numbers assigned.  So far they are 0, 6, 11 and 12.

     

    • 303 posts
    April 5, 2019 2:39 PM EDT

     hard to tell. 

     

    you have potentially 8 id numbers even though it goes up to 12, does at least every category you can choose from you drop down have atleast 1 user who has selected it ?

    • 217 posts
    April 7, 2019 12:47 PM EDT

    I can add as many categories as I want.  I will be adding 435 districts which will add to 435 numbers in the category_id column in the table.  I add them in the admin control panel at a location shown below.  Don't lose sight of the goal here.  I need to make the scroll down menu default setting "no response" so that if I make it a required question people must choose a district or none but they cannot leave the answer on "no response."

     

    • 303 posts
    April 7, 2019 1:07 PM EDT

    Firstly I'm not losing sight of the goal. I'm trying to understand how your custom plugin works. 

    Secondly, the reason behind my asking is whilst trying to understand your plugin there is a very good chance that a category id is unique and nonreusable 

     

    district 1 = id1

    district 2 = id2

    district 3 = id3 

     

    Now if you deleted district 2 because of a spelling error and recreated it you could have the following

     

    district 1 = id1

    district 2 = id4

    district 3 = id3 

     

    This isn't uncommon. 

     

    Seeing as you were able to get the code snippet from the people who built this for you they should be the ones who should be able to fix this also. 

     

    You need to find out what/if the "none" option holds as an id if at all, if it does then you would need to remove that id from the database structure. If it doesn't have an ID then it's likely hard-coded into your code and the snippet presented earlier only shows the code getting formation from the database. 

     

    To test whether or not it does have an ID use your own account, select a district and go to your database, find your account and see which id you have selected

    then go back and select the none option and see what the id is hopefully, it will have changed and you will see that it has an id.

    A lot of this is guesswork as we don't know what the custom code looks like in its entirety.


    This post was edited by PeppaPigKilla at April 7, 2019 1:09 PM EDT
    • 119 posts
    April 7, 2019 2:03 PM EDT

    @cmackie

     

    Sorry, I haven't been much in touch, been rather busy.

     

    By the looks of it is a 3rd party plugin or module you are using, unfortunate I do not know where the files and data are stored.

    I had a look at the images you shared of the tables they look good to me, nothing wrong for the standard SEPHP without 3rd party modules.

     

    Where you have to look, look at the source files of the plugin:

    Make a backup copy of the file(s)

    Download the files, and open them up with Notepad.

    Somewhere in the file, you will find a bit of code linking to the 'Question'.

    What I think is:

    1. It is not using the index[0] of the array (number 1 for human language)
    2. An empty string is written to the listIndex[0].value or it hasn't been populated from the DB field to use the index[0] to be overwritten by the first value of the table of the sorted index table from memory.
    3. or the ListIndex[0].value should be overwritten with a string '- Please select -' and made compulsory.

    This is where you have to look.

    Please note: all index numbers are unique in all tables of the database, if you delete a record with an index manually from the DB, this index number is no more available and the relations are no longer available by the software. 

    Software wise: You can only add to the database whereby the numbers increase.

    Deleting software wise: It deletes the record but doesn't re-arrange the indexes so it starts with 0 again (1 in human language), that is why you have gaps in between index numbers as they are unique.

     

     


    This post was edited by Maurits at April 8, 2019 6:36 AM EDT
    • 217 posts
    April 8, 2019 1:56 PM EDT

    Maurits:  You say I have to look at the source files of the plug in.  Do you have any idea what plugin is being used here?  My plugins are shown in an image I uploaded above.

     

    Peppa:  I signed in as a new user and selected "none."  Then I checked the category_id of this new user and the value was 0. 

    • 303 posts
    April 8, 2019 2:23 PM EDT
    I’m assuming you use whm/cPanel


    Login to your servers admin page ( cPanel )

    Click file manager

    Click public_html

    Now depending on whether your domain is the root or it’s an addon domain , if it’s root you’ll see a folder called applications. If it’s not your root you’ll see your domain, go into that folder and you’ll see applications.

    Follow the path
    Applications
    Modules
    Should be a folder called CeCustoms


    Inside this folder will be your plugins files.

    There is a great chance there will be multi folders and files. I’ve not dived into them before so I’ll have a look at mine and see if I can find roughly where you should be looking.

    Unless someone else mentions it before me.

    • 119 posts
    April 14, 2019 10:36 AM EDT

     @cmackie

     

    The other way of doing this is ad an option 'required' in the HTML and rename the first record in the table to 'Please select from the list below'.
    This way you have a required field with a category_id=Nothing which is not accepted.

    https://werunthehouse.org/cecustom/edit/district

    1.) You have to edit the first record in the table where it says 'None' to 'Please select from the list below'.

    2.) You have to find the HTML form code and add 'required' to one line of code. See the blue line in the image.

     

    The result after adding 'required' to the line above is:

     

    It will work without editing the database record. Only adding one word 'required' to the line of code you get a result.

    This is a quick fix for the solution with an [option value='None']

    I am not familiar with this customer 3rd party software, so you have to find the HTML source.

     

    Please note: this will be overwritten if you install an module update of your 3rd party


    This post was edited by Maurits at April 14, 2019 10:42 AM EDT
    • 217 posts
    April 16, 2019 10:38 PM EDT

    Thanks Maurits!  I will ask where the HTML code is and get back to you.

    • 217 posts
    May 1, 2019 2:02 PM EDT

    Maurits,

    The code I sent you may not be from the right place.  The question appears to have code associated with it in several places.  Here is the first place:

     

    There is are a button on sign up which asks "in which district are you eligible to vote". The answer to this is assigned to "category_id" in the database under engine4_users . The code that makes this assignment is here:

    File Path: /public_html/application/modules/Cecustom/controllers/EditController.php

     

    <?php class Cecustom_EditController extends Core_Controller_Action_User { public function init() { if (!Engine_Api::_()->core()->hasSubject()) { // Can specifiy custom id $id = $this->_getParam('id', null); $subject = null; if (null === $id) { $subject = Engine_Api::_()->user()->getViewer(); Engine_Api::_()->core()->setSubject($subject); } else { $subject = Engine_Api::_()->getItem('user', $id); Engine_Api::_()->core()->setSubject($subject); } } if (!empty($id)) { $params = array('id' => $id); } else { $params = array(); } // Set up navigation $this->view->navigation = $navigation = Engine_Api::_() ->getApi('menus', 'core') ->getNavigation('user_edit', array('params' => $params)); // Set up require's $this->_helper->requireUser(); $this->_helper->requireSubject('user'); $this->_helper->requireAuth()->setAuthParams( null, null, 'edit' ); } public function districtAction() { $this->view->user = $user = Engine_Api::_()->core()->getSubject(); $this->view->viewer = $viewer = Engine_Api::_()->user()->getViewer(); // Get form $this->view->form = $form = new Cecustom_Form_Edit_District(); // // Get current row // $table = Engine_Api::_()->getDbtable('styles', 'core'); // $select = $table->select() // ->where('type = ?', $user->getType()) // ->where('id = ?', $user->getIdentity()) // ->limit(); // // $row = $table->fetchRow($select); // Not posting, populate if (!$this->getRequest()->isPost()) { $form->populate(array( 'category_id' => (null === $user ? '' : $user->category_id) )); return; } // Whoops, form was not valid if (!$form->isValid($this->getRequest()->getPost())) { return; } // Cool! Process $category_id = $form->getValue('category_id'); $user->category_id = $category_id; $user->save(); $form->addNotice(Zend_Registry::get('Zend_Translate')->_('Your changes have been saved.')); } }

     

     

    But there is also code related to the question here: 

    File Path: /public_html/application/modules/User/Form/Signup/Account.php (approx line: 289)

    $categories = Engine_Api::_()->getDbtable('categories', 'cecustom')->getCategoriesAssoc(); if( count($categories) > 0 ) { $this->addElement('Select', 'category_id', array( 'label' => 'In which district are you eligible to vote?', 'multiOptions' => $categories, )); }

     

    Also:

    File Path: /public_html/application/modules/Cecustom/Form/Edit/District.php

    <?php class Cecustom_Form_Edit_District extends Engine_Form { public function init() { $this->setTitle("Edit District"); //SES Custom Work $categories = Engine_Api::_()->getDbtable('categories', 'cecustom')->getCategoriesAssoc(); if( count($categories) > 0 ) { $this->addElement('Select', 'category_id', array( 'label' => 'In which district are you eligible to vote?', 'multiOptions' => $categories, )); }

     

    Where in this code do I add what you suggested?