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

Please use our new MachForm Community Forum instead.

MachForm Community Forums » MachForm 2

Add value of a custom field


  1. fumagally
    Member

    I add a "input type hidden" with the name and id = "vip" in "edit_form.php". The value of this input i get dinamic via GET.

    I create the colum "vip" in the table ap_form

    how to get and insert value of the input "vip" when add new form? only when add.

    sorry my bad english... thanks...

    Posted 13 years ago #
  2. fumagally
    Member

    example of my code:

    edit_form.php
    ....
    <form style="display: none;" id="form_properties" action="" onsubmit="return false;">
    <input type="hidden" name="vip" id="vip" value="<? if($_GET["vip"] == "yes"){ echo "yes"; }?>" />

    =====================================

    js/machform.js

    .....
    function prepare_form_property_values()
    {
    JJ("#vip").val(main_form.data.vip);
    .....

    =====================================

    But on save new form the value no change in table... help?

    Posted 13 years ago #
  3. fumagally
    Member

    in includes/db-functions.php the code bellow:

    foreach ($data as $key=>$value){
    $value = mysql_real_escape_string($value);
    $field_list .= "$key,";
    $field_values .= "'$value',";
    }

    How to get field #vip ?

    this is the solution... because then the data will be inserted below in code:

    $query = "INSERT INTO ap_forms ($field_list) VALUES ($field_values);";

    Posted 13 years ago #
  4. redityo

    I think it would be easier to put a single line text in your form and hide the field using css code. That would save "vip" / text field value in the entries. You can see this post for further info :

    http://www.appnitro.com/forums/topic/passing-a-url-into-a-hidden-field?replies=4


    MachForm Support

    Posted 13 years ago #
  5. fumagally
    Member

    I paste the code in view-functions.php

    ...............
    if (!empty($_GET['vip']))
    {
    $element->vip = $_GET['vip'];
    }
    $element_markup = <<<EOT
    ...............

    but still did not work... I could explain it better please.. thanks

    Posted 13 years ago #
  6. fumagally
    Member

    I want to do is insert a new field to add when adding a new form...

    Posted 13 years ago #
  7. fumagally
    Member

    is not when submitting a form ... is when I add a form in admin

    Posted 13 years ago #
  8. fumagally
    Member

    Anyone?

    Posted 13 years ago #

RSS feed for this topic

Reply