Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2010
    Thanked 0 Times in 0 Posts

    Exclamation Firefox Autofill Forms Plugin - Choose random values for forms

    I'm using the autofill forms plugin for firefox which can be found here:


    I use it to automatically fill various web forms, duh. But I would like certain values to be chosend randomly from a list I create.

    I contacted the developer and he said the add on probably does not need a new feature because there is a 'dynamic tags' function to fill certain forms with dynamic values (e.g. the current time or date). He has given over the project to another developer and told me I probably would find a solution in a good javascript programming forum.

    So here I am! Can anyone help me with this? Basically, I just need a javascript code which chooses on item from an array randomly, I guess? I'm not a programmer myself, so any help would be greatly (!) appreciated.

    Thanks a lot in advance for any further guidance!

    Note: Here are sample dynamic tags from the plugin:

    <datetime> new Date().toLocaleString()
    <useragent> navigator.userAgent
    <langcode> navigator.language
    <resolution> screen.width+'x'+screen.height
    <clipboard> this.getClipboardText()
    Last edited by codergirl; 05-06-2010 at 08:08 PM.

  2. #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,699 Times in 2,675 Posts
    Here is a suitable script, but I am puzzled why you want "certain values in a form to be chosen randomly from a list I create" Could you explain the point of this?

    <script type = "text/javascript">
    var myArray = ['One','Two','Three','Four','Five','Six'];  // you can have as many values as you like - remember no comma after the last value.
    function randOrd(){return (Math.round(Math.random())-0.5); }
    myArray.sort(randOrd);  // shuffle the values into random order
    var theRandomValue = myArray[0];
    alert (theRandomValue);  // for testing
    If it is not clear, the first random value is myArray[0], the second random value is myArray[1], and so on. This script has the merit that the same random value cannot be seletced twice (unless he page is refreshed).

    "I like long walks, especially when they are taken by people who annoy me." - Noel Coward
    Last edited by Philip M; 05-06-2010 at 08:24 PM. Reason: Typo

  3. #3
    New to the CF scene
    Join Date
    Apr 2010
    Thanked 0 Times in 0 Posts
    Thanks for your fast help! But I think I need something else, I'm not sure, though.

    For example, I want to randomly choose between different anchor texts, meta descriptions and keywords when submitting a site to web directories.

    By using autofill forms I can quickly fill all the static values like name, country, agree to terms etc.

    But I'd like to choose certain values randomly from different sets I create. Say, if I had an affiliate website on acne treatment, I could automatically fill the keywords form with:

    acne, acne treatment, acne cure, acne product
    acne, acne remedy, acne home remedies, acne treatment options
    acne, acne scars, acne scar removal, acne cream

    The plugin has a 'dynamic tags' function like I outlined in my first post. It consists of the shortcode for the value, like:


    And you can set a code for each of these dynamic tags, like the sample codes I posted before:

    new Date().toLocaleString()

    Now I need something which looks sort of like this:

    shortcode: <acnetitle>
    code for this dynamic tag: 'Acne Treatment'.or.'Acne Cure'.or.'Acne Help'

    I have never did anything with java script before. I know some html and php, I can create videos, website templates, graphics, game sprites, I know a lot about wordpress.. but there always is something new, it seems. So I'm desperately looking for help with this, I really don't know how to achieve this by myself.

    EDIT1: Here's a screenshot of the plugin menu where you can define the dynamic tags: http://kl.am/bXW7

    EDIT2: Maybe one could also get the values from .txt files if it's not possible to directly enter the code?
    Last edited by codergirl; 05-06-2010 at 08:57 PM.


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts