Customer Portal

Get Involved. Join the Conversation.

Topic

    ilamukky
    Form submit for custom input widgetAnswered
    Topic posted July 16, 2015 by ilamukky Gold Medal: 3,500+ Points, last edited July 16, 2015 
    1027 Views, 4 Comments
    Title:
    Form submit for custom input widget
    Content:

    Hello, I am trying to create a custom widget, and to place it in a form with a formSubmit button.



    PAGE CODE:




    <form id="rn_CreateAccount" method="post" action="" onsubmit="return false;">
    <rn:widget path="input/FormInput" name="contacts.email"
    required="true" require_validation="true" />
    <rn:widget path="input/SetLogin" /> (my widget)
    <rn:widget path="input/FormSubmit"
    label_button="#rn:msg:CREATE_ACCT_CMD#"
    on_success_url="/app/account/overview"
    error_location="rn_ErrorLocation"/>
    </form>


     



    WIDGET CODE:




    RightNow.namespace('Custom.Widgets.input.SetLogin');
    Custom.Widgets.input.SetLogin = RightNow.Field.extend({
    overrides: {
    constructor: function() {
    this.parent();
    [...code...]
    this.parentForm().on("submit", this.onValidate, this);
    }
    },
    onValidate: function() {
    [...code...]
    var eventObject = this.createEventObject();
    RightNow.Event.fire("evt_formFieldValidatePass", eventObject);

    }
    });


     



    But I receive the error:

    Error: You're using a form that doesn't have a proper form submit button or an id



    I have this error in every custom input widget I try to create (also in Chat page, AskAQuestion page... see also https://cloudcustomerconnect.oracle.com/posts/1f46ab9018 )

    What am I missing? Thanks very much

    Version:
    Feb2015 CP3

    Best Comment

    ilamukky

    Thanks Anuj... I resolved by extending a standard input widget, and firing an event from my widget to this extended one, to pass the data to be validated.

    Comment

     

    • Anuj Behl
      Not sure if it'll work but can you try adding a value to 'action' attribute in form tag and maybe also removing the 'onsubmit' attribute.
      
    • ilamukky

      Thanks Anuj... I resolved by extending a standard input widget, and firing an event from my widget to this extended one, to pass the data to be validated.

    • Anuj Behl

      Great! Thanks for sharing your solution.

    • Pavel Franger

      Is it possible to update a custom field using the input/FormInput? 

      my code:

      Tried it both way...

      <rn:widget path="input/FormInput" name="contacts.customFields.c.contact_type" required="true" label_input="Who are you enquiring for" />

      <rn:widget path="input/FormInput" name="contacts.c$contact_type" required="true" label_input="Who are you enquiring for?" />

      Thank you in advance.