How can we set field values in Onsubmit event handler for Ne

Posted by Sudhakar on 12-May-2014 13:37

Hi all,

Can any one help me How can we set field values in Onsubmit event handler for New pages(note::i know that we can assign default values for the field but i want to assign default value only when new record is created from specific new Page)

All Replies

Posted by Santosh Patel on 12-May-2014 22:21

Hi Sudhakar,

There seems to be a problem with onsubmit event inclusion on portal pages. We have a logged a bug for the same.

In case your scenario needs a default value to be present I'd advise you to use the onload event handler. I have verified onload handler.

Regards,

Santosh

Posted by Sudhakar on 13-May-2014 01:11

Thanks [mention:7e24e60fbecc4ff8baf4669a65bae0a0:e9ed411860ed4f2ba0265705b8793d05] ,

I have tried onload event handler(rbf_setFieldContent("city","Hyd");) bcz of this i am able to display default values in new page,but the values i have displayed are not storing.
if i try rbf_setFieldValue("city", "Hyderabad"); in onload event i am able to store the values but according to my requirement the city values are not editable in new page, the default values should be assign in new page with not editable option and the values showed by using setfieldcontent fn should store..

Thanks,

sudhakar.

Posted by Santosh Patel on 13-May-2014 02:16

Hi Sudhakar,

We now have a clear picture of your problem.

rbf_setFieldContent sets the HTML content of a field on the current page. This seems to set the value visibly the way you want it but it also removes the HTML Input element associated with the field. Using this removes the field from the form submit.

Could I urge you to use the following approach? (the visual feel is a bit different to what you want)

- rbf_setFieldValue('city','Hyd') followed by rbf_setFieldDisabled('city',true)

or with your original (visual) requirement you can do the following:

- add a hidden input field to carry the value

- set the actual value using rbf_setFieldValue function

sample code:

var city = document.createElement('input');

city.name='city';     // This should be the integration name of the field

city.type='hidden';

document.theForm.appendChild(city);

rbf_setFieldValue('city','Hyd');

Posted by Sudhakar on 13-May-2014 11:15

Thanks for your reply [mention:7e24e60fbecc4ff8baf4669a65bae0a0:e9ed411860ed4f2ba0265705b8793d05] ,

The combination of rbf_setFieldValue('city','Hyd') ; rbf_setFieldDisabled('city',true); in onload event also not storing data,its just displaying the value in read only mode .

Kindly let me know is there any possibility to store data.

Thanks,

Sudhakar.

This thread is closed