Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormData fields being reinitialised resulting in failed form submission #446

Closed
spudmusket opened this issue Mar 28, 2024 · 3 comments · Fixed by #443
Closed

FormData fields being reinitialised resulting in failed form submission #446

spudmusket opened this issue Mar 28, 2024 · 3 comments · Fixed by #443
Assignees
Labels
Milestone

Comments

@spudmusket
Copy link

The initFormValues function in the pat/internal/forms/forms.go file initialises a number of form values which are 'blanking' out values when the html form is submitted back to the Pat interface. This results in some forms being sent with blank fields.

As an example the Winlink Check-in form has the Message To field and the Form 1b. To: field blanked out when the Form is submitted back to the Pat "New Message...' window.

Note this is one example, there are other forms affected.

The code in the initFormValues function is shown below (line 990 Pat v0.15.1):

// some defaults that we can't set yet. Winlink doesn't seem to care about these
// b.FormValues["msgto"] = ""
// b.FormValues["msgcc"] = ""
// b.FormValues["msgsubject"] = ""

Note, I have commented these out and recompiled Pat and confirmed that all works as it should when these are not reinitialised.

I would suggest that the values should either not be initialised as they are, or a test is carried out to check if they contain data before initialising them.

I'm not sure why they are needed and my go coding knowledge is limited so I've not posted a patch. I only checked a few forms, some other variables being initialised may affect other forms?

Example form showing the problem fields (note these are showing after the code correction above) - without the change they are blank:
checkin

@martinhpedersen
Copy link
Member

Hi,

Thanks for the detailed bug report ⭐

We're in the process of a major rewrite of the templates engine in Pat. I believe this is one of the things that have already been fixed in the revamp (#443). Can you please try compiling the branch more-templates-improvements?

Thank you!

@martinhpedersen martinhpedersen self-assigned this Mar 28, 2024
@martinhpedersen martinhpedersen added this to the v0.16.0 milestone Mar 28, 2024
@spudmusket
Copy link
Author

Hi Martin,

I have just built the more-template-improvements tree, and it appears to now work as expected. This was just a quick check for the Check-in Form. Over the next little while I'll test a few other forms and if I find issues I'll report back here.

Many thanks for your quick response and the work that you and others do for this project.

Myles.

@martinhpedersen
Copy link
Member

Thanks Myles, appreciate the feedback :)

There is still a couple of missing features I'd like to add, but I believe the changes in that branch are good enough to be included in the next release. Before merging I need to verify that the changes does not break existing functionality. So any feedback is much welcomed.

Thank you!

@martinhpedersen martinhpedersen linked a pull request Mar 28, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants