Categories

.presentationUiStateselection()

Categories: UI

.presentationUiStateselection( [ options ] )

Subclass: de_epages

Inherit: (Subclass: de_epages) .widget()

Plugin: de_epages.presentation.ui.stateselection

Description: Create a stateselection widget. As used for address inputs.

  • .presentationUiStateselection( [ options ] )

    version added: 6.15.0

    options   A map of additional options to pass to the method.

Calling .presentationUiStateselection() creates a stateselection as you can see on all addresses in the storefront and backoffice.

  • Render stateselection with respect to a already present country selection.

    HTML:
    <div class="InputBlock">
    <div class="InputLabelling">Country *</div>
    <div class="InputField">
    	<select name="CountryID" class="LongText" id="ID50A1052BAC1432E11D38_CountryID">
    		<option value="">(Select entry)</option>
        <option value="372">Ireland</option>
        <option value="484">México (Mexico)</option>
        <option value="840">United States</option>
        <option value="300">Griech (Greece)</option>
      </select>
    </div>
    </div>
    
    <div id="ID50A1052BAC1432E11D38_StateDiv" class="InputBlock HideElement">
    	<div class="InputLabelling"></div>
      <div class="InputField"></div>
    </div>
    
    Code:
    jQuery.ready({
    	DOM : true,
    	plugin : ['de_epages.presentation.ui.stateselection']
    }, function ($) {
    	de_epages('#' + 'ID50A1052BAC1432E11D38_StateDiv').presentationUiStateselection({
    		"input":{
    			"name":"State",
    			"id":"ID50A1052BAC1432E11D38_State",
    			"mandatoryStar":"*",
    			"label":"County",
    			"emptyEntry":"(Select entry)"
    		},
    		"countrySelectId" : "ID50A1052BAC1432E11D38_CountryID",
    		"cssClasses":{
    			"dialogError" : "DialogError",
    			"inputField" : "InputField",
    			"inputLabelling" : "InputLabelling",
    			"input" : "Text",
    			"select" : "LongText"
    		},
    		"countryId":"276",
    		"preselectedState":"",
    		"shopAddressCountryId" : "276",
    		"formError":false,
    		"shopRegistrationField":{
    			"state":{
    				"isVisibleName":false,
    				"isMandatoryName":false
    			},
    			"countryId":{
    				"isVisibleName":true,
    				"isMandatoryName":true}
    			}
    		},
    		"data":{
    			"300":{"subdivsMandatory":false,"subDivisions":[]},
    			"372":{"subdivsMandatory":false,"subDivisions":[]},
    			"484":{"subdivsMandatory":true,"subDivisions":[
    				{
    					"code":"BCS",
    					"language":{
    						"english":"Baja California Sur",
    						"native":""
    					}
    				},
    				{
    					"code":"COA",
    					"language":{
    						"english":"Coahuila",
    						"native":""
    					}
    				}
    			]}
    			"840":{"subdivsMandatory":true,"subDivisions":[
    				{"code":"AL","language":{"english":"Alabama","native":""}}
    			]}
    		}
    	});
    });
    
    
    
    
  • input

    version added: 6.15.0

    A hash specifying the state input field to be created. (E.g. with keys "name", "id",...)

  • countrySelectId

    version added: 6.15.0

    Id of the corresponding country select element.

  • cssClasses

    version added: 6.15.0

    A hash specifying the relevant css classes. (E.g. "dialogError", "inputField",...)

  • countryId

    version added: 6.15.0

    Id of selected country.

  • preselectedState

    version added: 6.15.0

    Code of preselected state.

  • shopAddressCountryId

    version added: 6.15.0

    Id of country of the shop address.

  • formError

    version added: 6.15.0

    Boolean indicating whether this state selection caused a formError.

  • shopRegistrationField

    version added: 6.15.0

    Hash specifying whether state/country selection is visible/mandatory for the shop.

  • data

    version added: 6.15.0

    Data hash of the countries and their states.