NetTalk Central

Author Topic: Conditional Save button  (Read 4747 times)

robirenz

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Conditional Save button
« on: April 14, 2009, 10:22:57 AM »
Hi All..

Is it possible to condinionally enable or disable the save button..
if not, then is it possible to alter the post of the save button, my problem is that in my netwebform I don't have fields, I have buttons that alter some fields..
So for instance I have four options on a screen and I have to select 2 of them, remebering that the only way to change those options are with buttons that I have onscreen.
when I press the save button then in the record validation I count how many options there are and I have to set alert and invalid fields to the approprite record, however there really is no approprite record to set the invalid record so, I just select the top most one.
anyway once I have alerted the subject he then presses the the button to select or deselect my fields. however since my alert is still active then I get the same window, againa and again telling me to select two options..

I think the reason is that the post has a "pressedButton=save_btn"  at the end of it, so it seem to have the save button pressed again and again even though I have to pressed it again but an option on the screen..

I think What I'm asking, is if there is a way to clear the alert and invalid fields so that the form no longer takes then in cosideration when I press any of my buttons.  I have set alert='' and invalid='' but it still insist on present the error. Or how do I take out the "pressedButton=save_btn"  off of the post after it has come back with an error.

If I remember right 4.29 and previous did not have this kind of pressed button insistance, and now it does..  athough I may not recall correctly.

Best Regards...

Roberto Renz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Conditional Save button
« Reply #1 on: April 14, 2009, 10:27:30 PM »
Are the buttons you are adding to the form, "Submit" buttons, or just "Buttons"?

Cheers
Bruce

robirenz

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Conditional Save button
« Reply #2 on: April 15, 2009, 06:00:28 AM »
Bruce,

I have set up my buttons as display fields.
then in setting I select button and add all the schnazzy stuff, like css and icon, etc.
on server code I process my code and reset some variables on screen so that the button color changes with a different css style, etc  Server code is to analyze whether I've pressed already or not, and if not to set a flag on specified field and paint my button as selected.
There is probably way better ways to do this, it's just that I already did it this way and have done like 640 different screens in my application this way, and changing it all would be a hell of a lot of work. :)

I did notice on the advanced tab of the Netwebform procedure that there is a popup invalid Message in Browser.  This was on so maybe reason for persistent popops, however it still pops up once now and then lets me change accordingly, but I can't get rid of the error message up on top of the form.  I works a lot better now, since it's not so insistant on the popups like it used to be, but would be great if I can figure out how to reset the error message to none from the server code section..

Best Regards...

Roberto Renz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Conditional Save button
« Reply #3 on: April 15, 2009, 06:10:58 AM »
Hi Roberto,

ok, yes, I get how you added the button. I just wanted to be sure (and it sounds like it is) that the button "type" is set as "button" not "submit".

I think you can clear the alert by setting loc:alert to ''. but it's hard to be sure 'cause I don't know your exact context.
The best, if at all possible is to add a page to any of the examples to explain the effect, then post that to me, or post it here.

Cheers
Bruce


robirenz

  • Jr. Member
  • **
  • Posts: 88
    • View Profile
    • Email
Re: Conditional Save button
« Reply #4 on: April 15, 2009, 08:13:14 AM »
Bruce,,

Lets rework this,,

Using firefox..  so... whatever that could mean... :)

after I get an error message.
I can press a button on screen and I run code to clear both of my variables
  loc:alert = ''
  loc:invalid = ''
I need that loc:invalid set to something because otherwise the page runs to the next page even though I have not met my criteria.

becuase the loc:invalid varible is a readonly checkmark I have on screen that is contolled only by the button then there is no way for me to reset the the loc:invalid state of given variable even though I force the loc:invalid = '' which has no effect I still get the error message across the top of the screen.
The only way to get rid of such code is to have a real modifieble variable on screen and when you tab off of it then it will reset the loc:invalid and loc:alert messages.
my big question is how to get rid of the invalid and alert messages withought it jumping to the next page automatically until I press the send button again.  Well in my case where there is no real capture data and it is all done with the buttons. I'm sure it has to do with loc:invalid = 'varible' set which is read only but... well I'll wait and see what you say about it.

Best Regards...

Roberto Renz

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Conditional Save button
« Reply #5 on: April 15, 2009, 11:38:59 PM »
Hi Roberto,

I think this line is the key.

>> I need that loc:invalid set to something because otherwise the page runs to the next page even though I have not met my criteria.

If your button type is a _button_, and not a _submit_ then you would _not_ need to set loc:invalid.
So go make sure your buttons are set as _buttons_.
Ie find the drop down that let's you set them as button, or submit, and make sure it's set to button.

Cheers
Bruce


[attachment deleted by admin]