#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Alternative to RegisterOnSubmitFunction(...);


    First of all , greetings to all .

    I opened this topic to see if someone can support me in the following issue .

    I've been using for several years a system which I program processes, which I have no access to the code. On the client side allows me to create forms in which I can use javascript and the system adds the Submit button to the form, which I have no control to.

    Today I am migrating to a new version of the system and I have to develop some forms. A function widely used to perform calculations and also validate information was complex fields : RegisterOnSubmitFunction (...);

    Alternative to RegisterOnSubmitFunction(...);

    This feature helped me at the time of executing the submit button, perform some function and return false if not validate anything. stopping the form prosesing.

    The problem is that in the new instance no longer uses buttons Input type, but the label <button>

    Before it was as follows :

    Reviewing the source code, the button was so

    Code:
    <input type="submit" name="button" id="button" value="Submit" />
    and the code I entered was inserted into the body

    Code:
    <body> ..
    
    //Here I was programming my form
    
    <SCRIPT type="text/javascript">
    
    function process () {
    .....
    }
    
    RegisterOnSubmitFunction ( process );
    
    < / SCRIPT >
    
    <body>
    But now the button is as follows:


    Code:
    < div class = "x -btn x -btn -blue -button -small x -box- item x -toolbar -item x -btn -default -toolbar -small x - noicon x -btn - noicon x -btn -default- noicon -small- toolbar "style = " border -width: 1px ; border-color : rgb (209 , 209, 209 ) important , display : none ; "id =" button- 1391 ">
       <em id="button-1391-btnWrap">
          <button id="button-1391-btnEl" type="button" class="x-btn-center" hidefocus="true" role="button" AUTOCOMPLETE="off">
             <span id="button-1391-btnInnerEl" class="x-btn-inner" style=""> Submit< / span >
             <span id="button-1391-btnIconEl" class="x-btn-icon "> < / span >
          < / button>
       < / em >
    < / div >
    And when I try to use RegisterOnSubmitFunction not work

    An alternative method that comes to mind?
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,188
    Rep Power
    184
    The first thing, that I think I would do; is read the documentation, that are relevant to less restrictive/more interactive coding (by you... the end user of the service). Usually in the documentation; you will find common/newly updated practices for coding with a programming or pseudo programming language. This would be your best bet. Next, if that does not help; see if they have a forum and search forum/post question(s) about this issue and see if the community will help you. Next, if that does not work; contact the author or contributors of the language. These are your best practice approaches; with a situation, like the one you are facing.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0

    Htanks


    Originally Posted by web_loone08
    The first thing, that I think I would do; is read the documentation, that are relevant to less restrictive/more interactive coding (by you... the end user of the service). Usually in the documentation; you will find common/newly updated practices for coding with a programming or pseudo programming language. This would be your best bet. Next, if that does not help; see if they have a forum and search forum/post question(s) about this issue and see if the community will help you. Next, if that does not work; contact the author or contributors of the language. These are your best practice approaches; with a situation, like the one you are facing.
    Hi Web_loone, Thank you very much for your response and interest, I understand what you say, it's actually the first thing I did. But the documentation is not anything about this, or alternative forms actually mentioned this feature in lversión 4.7, but not in the documentation for version 6.

    I have an appointment on the provider, but until Monday, and as I have time over, so seek alternative options.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2014
    Posts
    3
    Rep Power
    0
    The idea of ​​eventListener took me to see this and other options and found a feature that was very useful to me and I was able to solve the problem. I do not know if it is the best option but I will temporarily:

    Seeking all Span tags, and if the inside text is Submit, took the ID

    I had to use the "parent" because I realized that my code was within a iFame

    Code:
    var inputs = parent.document.getElementsByTagName("span");
    
    for (var i = 0; i < inputs.length; i++) {
    
      tagBoton = inputs[i].id;
    	if(tagBoton != "")
    		if(parent.document.getElementById(tagBoton).textContent == "Submit")
    			idBoton = parent.document.getElementById(tagBoton).id;
    		
    	
    }
    
    document.getElementById(idBoton).onclick=function(){procesar()};

IMN logo majestic logo threadwatch logo seochat tools logo