PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Insert code to a field

  1. isaoyoshikoshi
    Member

    Hello,

    I want to insert a javascript code ('onKeyUp' function) to address zip code field,
    but following code does not work (cannot insert address field when editing form).
    FYI, javasctipt code is inserted correctly to header section.

    Any suggestions?

    from common.php

    // want to insert this function:  onKeyUp="AjaxZip3.zip2addr(this,'','input_6.4','input_6.3');"
    $onKeyUp = sprintf("onKeyUp=\"AjaxZip3.zip2addr(this,'','input_%d.4','input_%d.3');\"", $id, $id);
    $zip = sprintf("<span class='ginput_{$zip_location}$class_suffix' id='" . $field_id . "_5_container'><input type='text' name='input_%d.5' id='%s_5' value='%s' $tabindex %s $onKeyUp/><label for='%s_5' id='" . $field_id . "_5_label'>" . apply_filters("gform_address_zip_{$form_id}", apply_filters("gform_address_zip", $zip_label, $form_id), $form_id) . "</label></span>", $id, $field_id, $zip_value, $disabled_text, $field_id);
    Posted 13 years ago on Wednesday July 27, 2011 | Permalink
  2. Are you trying to do this in the form editor? You should be applying any jQuery customizations to the front end of the form, not the form editor itself.

    Posted 13 years ago on Wednesday July 27, 2011 | Permalink
  3. isaoyoshikoshi
    Member

    Hi, Carl.

    Can you tell me where to modify code for insert OnKeyUp function to zip code field on the front end form?

    Thanks,
    Isao

    Posted 13 years ago on Thursday July 28, 2011 | Permalink