You are viewing limited content. For full access, please sign in.

Question

Question

A form field filled by a stored procedure using with Submit button event.

asked on May 2, 2015 Show version history

Hi there!

    I have to due with a requirement which is sending a field with a value to show up and save as PDF file in Repository.This form field will be filled in by a stored procedure and I need this value to be filled in when Submit button click only.

   I have 2 forms , a started form for submitting and a save to repository form to display that form field.

Here is the coding of started form

and here is a output form in repository.

And the lookup rules page

The scenario is when user click submit button then' Tempfield' field which's assigned a value will trigger stored procedure and fill in another field 'Tempfield2' and this field 'll be passed through output form then save into repository.

I could see values of both fields for a second when clicked submit button but I found that Tempfield2's  value disappear on output form in repository.

Any help would be appreciated.

 

0 0

Answer

SELECTED ANSWER
replied on May 5, 2015 Show version history

Hi there,

You need to wait for the value to be filled, then submit.

Here is an code example.

$(document).ready(function () {
 
  $('.Submit').on("click", function(event) {
    
    $('#q1 input').val('abby.shen');
    $('#q1 input').trigger('change');
    
    event.preventDefault();
    
    waitfunction();
    
  });
  
  function fieldfilled()
  {
    return ($('#q2 input').val() != '');
  }
  
  function waitfunction()
  {
    setTimeout(function(){    
      if(fieldfilled())
        document.getElementById('form1').submit();
      else
        waitfunction();
    }, 500);
  }
  
});

 

2 0

Replies

replied on May 4, 2015

Hi there,

Readonly field data won't be submitted when generated from front end. Can you try remove the readonly attr and see whether it works?

1 0
replied on May 4, 2015

Hi Abby,

   I 'v tried doing from your suggestion. and it didn't work.

Here is my started form javaScript page

And here is my output form JavaScript page

you can see no field set the properties as read only at all.

Here is output screen from the repository.

And the last one is the results page of the issue process.

You can see no value assign to Tempfield2

Did I miss something?

Please help.

0 0
SELECTED ANSWER
replied on May 5, 2015 Show version history

Hi there,

You need to wait for the value to be filled, then submit.

Here is an code example.

$(document).ready(function () {
 
  $('.Submit').on("click", function(event) {
    
    $('#q1 input').val('abby.shen');
    $('#q1 input').trigger('change');
    
    event.preventDefault();
    
    waitfunction();
    
  });
  
  function fieldfilled()
  {
    return ($('#q2 input').val() != '');
  }
  
  function waitfunction()
  {
    setTimeout(function(){    
      if(fieldfilled())
        document.getElementById('form1').submit();
      else
        waitfunction();
    }, 500);
  }
  
});

 

2 0
replied on May 5, 2015 Show version history

Thank you very much, Abby.

I 'll try this solution and let you know ASAP.

0 0
replied on May 6, 2015
$(document).ready(function () { 

 $('#form1').submit(function(event) {

    $('.Tempfield input').val('05'); 

    $('.Tempfield input').trigger('change');

    event.preventDefault();

    waitfunction();

  });

  function fieldfilled()

  {

    return ($('.Tempfield2 input').val() != '');

  }

  function waitfunction()

  {

    setTimeout(function(){    

      if(fieldfilled())

        document.getElementById('form1').submit();

      else

        waitfunction();

    }, 500);

  }

});

I 've tried your coding and replace your fields with mine. I can see value of  both Tempfield and Tempfield2 're appeared for a second. Suddenly a error message showed up.

Here is the error message screenshot .

Abby, please suggest.

Regards.

0 0
replied on May 6, 2015

Hi Abby,

     I found that error message appeared just when I clicked preview button.

But it works when using with start process button. Here is the output form.

So I would like to know that is it possible to use this solution with .Submit event ?

 $('.Submit').on('click', function () {
    
  
  });

And How to code this?

Regards,

0 0
replied on May 6, 2015

You can try return false in the function, see whether it stops the submission. And you will need another function to auto submit after fields are filled.

0 0
replied on May 6, 2015

Hi Abby,

  Please give me an example coding.I need this function to reuse and share with the other developers.It seems to be use this solution in many process of our site.

Thank you in advanced.

Regards,

0 0
replied on May 6, 2015 Show version history

Hi there,

We haven't tried the other options, the code provided is the suggested solution. It's also reusable.

replied on May 6, 2015 Show version history

Hi Abby,

     I'll try from your suggestion,thank you.

Regards,

0 0
replied on May 21, 2015 Show version history

Hi there,

I updated the code example with the button on click, let me know if it works for you. This should work for preview as well.

1 0
replied on May 21, 2015

Appreciate your help.

I 'll try your new code example ASAP.

0 0
replied on June 5, 2015

Hi Abby,

     Sorry for late reply, 

Your code works perfectly.

Thank you for all your support

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.