Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • tekknoir Friend
    #147400

    Hello,

    So, I am using this component in the UK, where postal codes are alphanumeric, as opposed to just numeric.

    This requires a small change to accomplish, but I thought I’d share in case anyone else required this one. Details below.. Always make a backup before you make changes of this sort to your website.

    This one is relatively easy to fix, but best if done before anyone signs up to the site, as there is a danger of losing all existing data from the zipcode column.

    You will need PHPMyAdmin or something of the sort, as it requires changing database variables you do not normally have direct access to.

    For the purposes of this post, I will assume your database prefix to be jos_ (default), but if you have a different prefix, use that instead.

    First, log into your database with PHPMyAdmin (or whatever you’re using). You need to edit a row from jos_ja_form_fields. By default this row has the following data to help identify it:
    `form_id` = 3, `label` = ‘Zip Code’, `field_ordering` = 10

    Edit this row, set `field_type` = ‘TEXTFIELD’, `old_field_type` = ‘TEXTFIELD’, `field_validate_type` = `not_empty`

    This changes the field generated on the “post a job” form, allowing you to use any non-blank value (basically, as long as there’s something in the box it’ll work, otherwise it won’t). It may also be worth setting `error_message` = ‘Please enter a zip code’ or something of the sort on this row, so it pops up a dialog box if they attempt to submit the form with this field blank.

    The above could be done with a MySQL query like:

    UPDATE jos_ja_form_fields
    SET
    `field_type` = 'TEXTFIELD',
    `old_field_type` = 'TEXTFIELD',
    `field_validate_type` = `not_empty`,
    `error_message` = 'Please enter a zip code'
    WHERE
    `form_id` = 3
    AND `label` = 'Zip Code'
    AND `field_ordering` = 10
    ;

    Next you need to re-declare the field type where the data is being stored.

    This is stored in jos_ja_jobs. You need to change the field `zipcode` from an integer field to a varchar. Doing this usually produces a warning about potentially losing all the data in that field, but MySQL is actually pretty good at retaining this data (at least when converting an integer to a string), so hopefully any numeric values already in there should translate over, but once again, always make a backup first.

    You can do this in PHPMyAdmin, either by browsing to the table and re-declaring the field type from there, or by executing the SQL query:

    ALTER TABLE
    jos_ja_jobs
    MODIFY
    `zipcode`
    VARCHAR(255)
    ;

    And that should do it ^_^ Now the form builder allows alphanumeric characters in zip code fields, and the database is capable of saving alphanumeric codes to that field.

    Please don’t try this if you have little to no understanding of what it all means, you can seriously mess up your site’s database if you’re not careful.

    Anonymous Moderator
    #328796

    Hi there,

    Thanks for sharing. However,

    – because Zipcode recorded within database has type = Varchar, it is not necessary to use the below sql
    (ALTER TABLE
    jos_ja_jobs
    MODIFY
    `zipcode`
    VARCHAR(255)
    😉
    + There is no need to run any sql command at all, to use zip code with character, you can follow below guide
    ++ Go to back-end -> Form customization -> select zip code field
    ++ Field “Type of check”: select value: “Must not be empty”

    didima Friend
    #328822

    good info guys, l might need soon 😉

    rv_ng Developer
    #369153

    post removed by poster

Viewing 4 posts - 1 through 4 (of 4 total)

This topic contains 4 replies, has 4 voices, and was last updated by  rv_ng 13 years, 4 months ago.

We moved to new unified forum. Please post all new support queries in our New Forum