This forum is no longer open and is for reading/searching only.

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 3

Populating a field with a dynamic value


  1. almasco
    Member

    I have a site that requires users to be logged in before accessing any forms. As part of each form, I have an element called User ID. I want to populate the element with the logged in user's id, which is stored in a session. I opened the view-functions.php file and placed the following code after line 4831.

    //Custom Code to populate User ID element with value from user id session.

    if($form_id == 1 && $element[$j]->id == 8)
    {
    $element[$j]->default_value = $_SESSION['jigowatt']['userid'];
    }

    When the form loads, the user id field is still empty. Please help.
    //End of Custom code

    Posted 12 years ago #
  2. yuniar

    I've just replied to your support ticket. Let's continue there instead.


    MachForm Founder

    Posted 12 years ago #
  3. MXZRXP
    Member

    seems like all these "populating a field" posts it says "lets continue in email"

    You could help a lot of folks (and save yourself much time) by posting here so other can see the solution.

    The "personal" approach is GREAT and don't stop it but post the results so everyone can see!

    Thanks!

    Posted 11 years ago #

RSS feed for this topic

Reply