cancel
Showing results for 
Search instead for 
Did you mean: 

clear form input values

Former Member
0 Kudos

Hi

I hav a form which contains 2 input text boxes.

User clicks on submit and moves to different view after filling form.

these values are mapped to context so that i can display them in next page.

Now wen i click on back button in view2....it takes me back in view 1.

I get my old values already there.

I wish if i could reset my form wen i Travers back to it.

1 method to do so is coding in init() method.

that i reinitialize my context in init method....

but i there any other way to do so....

thanks in advance

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

I am also new to this.

But u can use this on ur plug event.

wdThis.wdGetContext().currentContextElement().setCtx_firstname("");

wdThis.wdGetContext().currentContextElement().setCtx_lastname("");

Does anyone know of a better way? like setting a property

Tell me if it works

Vikram

Former Member
0 Kudos

Hi,

if you have a value node with attributes then you can use invalidate method .

example valuenode name is "Form". then wdContext.nodeForm().invalidate() will reset the data already present.

Regards,

ramesh

Former Member
0 Kudos

ok...

but then why they hav provided a function "invalidate" for root context node....!!

wdthis.wdgetcontext.invalidate() !!

Former Member
0 Kudos

Hi,

yes ,

if we want to reset all the context present in the view then we can use that one.

Regards,

ramesh

Former Member
0 Kudos

Hi....

yes i did used it.....

but the context was not reset.....

i was still getting old values in my form....

So, i was told that invalidate works only if it is used on nodes....

that was my point.....then y is it there for context...as it is not working there...!

Former Member
0 Kudos

Hi,

you mean wdThis.wdGetContext().invalidate(); this statement is not working in your case ?

i am not facing any problem here the values are clearing !

Regards,

ramesh

Former Member
0 Kudos

yes Ramesh it is not working in my case...

I am having a form with me having 2 fields...

i have mapped these field to view context attributes...

then these attributes to component context attributes...

now wen i am navigating from this view to second view.....these values are getting displayed there...

but on coming back to this view...old values are still present in that form......!!

i used wdthis.wdgetcontext.invalidate.....

but my form is still picking old values....!!

Former Member
0 Kudos

Hi,

Is't is a model Node?

Regards

Ayyapparaj

Former Member
0 Kudos

Hi,

Invalidate your node in Back Action button.

Regards

Raghu

Former Member
0 Kudos

Hi Saurabh Agarwal,

When you return back to Frist view from second view the plug method will execute.

You can reset the two context attributes in the onPlug method.

Regards,

VJR.

Former Member
0 Kudos

Hi VJR ...

yes this works !!

thanks.

but invalidate is not working....!!

i tried both

Former Member
0 Kudos

hii,

clear your input node after clicking the backbutton.

inputNode.invalidate();